Commit 9fce739d authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

article views

parent 8d7e1e07
......@@ -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
......
......@@ -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 %}
{% extends 'base.html' %}
{% block content %}
{% include 'ndh/form.html' %}
{% endblock %}
../form.html
\ No newline at end of file
{% 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 %}
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.ProjectsView.as_view(), name='home'),
path('', RedirectView.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'),
]
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment