Commit cd546a7e authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

django_tables2

parent 7b5d5a3a
......@@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_tables2',
'bootstrap3',
'rainboard',
]
......
import django_tables2 as tables
from .models import Project
class ProjectTable(tables.Table):
class Meta:
model = Project
template = 'django_tables2/bootstrap.html'
fields = ('main_namespace', 'name', 'license', 'homepage')
attrs = {'class': 'table table-striped'}
{% extends 'base.html' %}
{% load django_tables2 %}
{% block content %}
......@@ -39,17 +40,7 @@
<h2>Projects</h2>
<table class="table table-striped">
<tr>
<th>Namespace</th>
<th>Name</th>
<th>License</th>
<th>Homepage</th>
</tr>
{% for project in projects %}
{% include 'rainboard/project.html' with project=project %}
{% endfor %}
</table>
{% render_table projects %}
{% endblock %}
<tr>
<td>{{ project.main_namespace }}</td>
<td>{{ project.name }}</td>
<td>{{ project.license }}</td>
<td>{{ project.homepage }}</td>
</tr>
from django.shortcuts import render
from .models import Forge, Namespace, Project
from .tables import ProjectTable
def home(request):
return render(request, 'rainboard/home.html', {
'forges': Forge.objects.all(),
'namespaces': Namespace.objects.all(),
'projects': Project.objects.all(),
'projects': ProjectTable(Project.objects.all()),
})
Django
django-bootstrap3
django-tables2
psycopg2
requests
https://github.com/nim65s/ndh/archive/master.zip#egg=ndh
......
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