Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
9fce739d
Commit
9fce739d
authored
Jan 12, 2018
by
Guilhem Saurel
Browse files
article views
parent
8d7e1e07
Changes
7
Hide whitespace changes
Inline
Side-by-side
rainboard/tables.py
View file @
9fce739d
...
...
@@ -10,6 +10,12 @@ class StrippedTable(tables.Table):
attrs
=
{
'class'
:
'table table-striped'
}
class
ArticleTable
(
StrippedTable
):
class
Meta
:
model
=
models
.
Article
fields
=
(
'name'
,
'authors'
,
'year'
,
'url'
,
'pdf'
)
class
ForgeTable
(
StrippedTable
):
class
Meta
:
model
=
models
.
Forge
...
...
rainboard/templates/base.html
View file @
9fce739d
...
...
@@ -3,6 +3,7 @@
{% block pagetitle %}Gepetto Packages{% endblock %}
{% block sitetitle %}Gepetto Packages{% endblock %}
{% block navbarleft %}
<li><a
href=
"{% url 'rainboard:articles' %}"
>
Articles
</a></li>
<li><a
href=
"{% url 'rainboard:forges' %}"
>
Forges
</a></li>
<li><a
href=
"{% url 'rainboard:namespaces' %}"
>
Namespaces
</a></li>
{% endblock %}
rainboard/templates/form.html
0 → 100644
View file @
9fce739d
{% extends 'base.html' %}
{% block content %}
{% include 'ndh/form.html' %}
{% endblock %}
rainboard/templates/rainboard/article_form.html
0 → 120000
View file @
9fce739d
../form.html
\ No newline at end of file
rainboard/templates/rainboard/article_list.html
0 → 100644
View file @
9fce739d
{% extends 'base.html' %}
{% load django_tables2 %}
{% block content %}
<h1>
Articles
</h1>
{% render_table table %}
<a
class=
"btn btn-success"
href=
"{% url 'rainboard:article-new' %}"
>
+
</a>
{% endblock %}
rainboard/urls.py
View file @
9fce739d
from
django.urls
import
path
from
django.views.generic
import
ListView
from
django.views.generic
import
ListView
,
RedirectView
from
.
import
views
from
.models
import
Forge
,
Namespace
,
Project
from
.models
import
Forge
,
Namespace
,
Project
,
Article
app_name
=
'rainboard'
urlpatterns
=
[
path
(
''
,
views
.
Proj
ect
s
View
.
as_view
(),
name
=
'home'
),
path
(
''
,
Redir
ectView
.
as_view
(
pattern_name
=
'rainboard:projects'
),
name
=
'home'
),
path
(
'forges'
,
views
.
ForgesView
.
as_view
(),
name
=
'forges'
),
path
(
'articles'
,
views
.
ArticlesView
.
as_view
(),
name
=
'articles'
),
path
(
'article/create'
,
views
.
ArticleCreateView
.
as_view
(),
name
=
'article-new'
),
path
(
'namespaces'
,
views
.
NamespacesView
.
as_view
(),
name
=
'namespaces'
),
path
(
'projects'
,
views
.
ProjectsView
.
as_view
(),
name
=
'projects'
),
path
(
'project/<str:slug>'
,
views
.
ProjectView
.
as_view
(),
name
=
'project'
),
]
rainboard/views.py
View file @
9fce739d
from
django.shortcuts
import
render
from
django.views.generic
import
DetailView
from
django.views.generic
import
DetailView
,
CreateView
from
django_filters.views
import
FilterView
from
django_tables2
import
RequestConfig
...
...
@@ -10,6 +10,16 @@ from . import tables
from
.filters
import
ProjectFilter
class
ArticlesView
(
SingleTableView
):
model
=
models
.
Article
table_class
=
tables
.
ArticleTable
class
ArticleCreateView
(
CreateView
):
model
=
models
.
Article
fields
=
(
'name'
,
'authors'
,
'year'
,
'url'
,
'pdf'
)
class
ForgesView
(
SingleTableView
):
model
=
models
.
Forge
table_class
=
tables
.
ForgeTable
...
...
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