Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
rpteam
Revue de Press
Commits
0129c98c
Commit
0129c98c
authored
Apr 22, 2017
by
luxcem
Browse files
adds article list view
parent
dd7a373f
Changes
8
Hide whitespace changes
Inline
Side-by-side
apps/core/base.html
0 → 100644
View file @
0129c98c
apps/rp/models/article.py
View file @
0129c98c
...
...
@@ -22,3 +22,6 @@ class Article(UnDVotedMixin):
class
Meta
:
verbose_name
=
_
(
"Article"
)
verbose_name_plural
=
_
(
"Articles"
)
def
__str__
(
self
):
return
self
.
title
apps/rp/templates/rp/article_list.html
0 → 100644
View file @
0129c98c
{% extends "base.html" %}
{% block content %}
{% for article in object_list %}
{% endfor %}
{% endblock %}
apps/rp/urls.py
View file @
0129c98c
from
django.conf.urls
import
url
from
rp.views
import
upvote
,
downvote
from
rp.views.votes
import
upvote
,
downvote
from
rp.views.articles
import
ArticleList
urlpatterns
=
[
url
(
r
"^article/list"
,
ArticleList
.
as_view
(),
name
=
"article-list"
),
url
(
r
"^votes/upvote/(?P<content_type>\d+)/(?P<object_id>\d+)$"
,
upvote
,
...
...
apps/rp/views/__init__.py
View file @
0129c98c
from
.votes
import
upvote
,
downvote
,
UDList
# noqa
apps/rp/views/articles.py
0 → 100644
View file @
0129c98c
from
rp.models
import
Article
from
.votes
import
UDList
class
ArticleList
(
UDList
):
model
=
Article
project/settings/base.py
View file @
0129c98c
...
...
@@ -38,7 +38,7 @@ ROOT_URLCONF = "project.urls"
TEMPLATES
=
[
{
"BACKEND"
:
"django.template.backends.django.DjangoTemplates"
,
"DIRS"
:
[],
"DIRS"
:
[
"templates"
],
"APP_DIRS"
:
True
,
"OPTIONS"
:
{
"context_processors"
:
[
...
...
templates/base.html
0 → 100644
View file @
0129c98c
<!doctype html>
<html
lang=
"fr"
>
<head>
<meta
charset=
"utf-8"
>
<title>
LQDN RP
</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment