1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

use django_tables2

This commit is contained in:
Pierre-antoine Comby 2019-08-13 18:22:19 +02:00
parent a0c32890a9
commit f88ca61b34
3 changed files with 7 additions and 13 deletions

View File

@ -41,6 +41,7 @@ INSTALLED_APPS = [
'guardian', 'guardian',
'reversion', 'reversion',
'crispy_forms', 'crispy_forms',
'django_tables2',
# Django contrib # Django contrib
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.admindocs', 'django.contrib.admindocs',
@ -83,6 +84,7 @@ TEMPLATES = [
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
], ],
}, },
}, },
@ -159,7 +161,7 @@ STATICFILES_DIRS = [
os.path.join(BASE_DIR,'static')] os.path.join(BASE_DIR,'static')]
CRISPY_TEMPLATE_PACK = 'bootstrap4' CRISPY_TEMPLATE_PACK = 'bootstrap4'
DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap4.html'
# URL prefix for static files. # URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/" # Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/' STATIC_URL = '/static/'

View File

@ -8,6 +8,7 @@ django-extensions==2.1.9
django-guardian==1.4.9 django-guardian==1.4.9
django-polymorphic==2.0.3 django-polymorphic==2.0.3
django-reversion==3.0.3 django-reversion==3.0.3
django-tables2==2.1.0
docutils==0.14 docutils==0.14
idna==2.8 idna==2.8
oauthlib==3.1.0 oauthlib==3.1.0

View File

@ -1,17 +1,8 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load render_table from django_tables2 %}
{% block content %} {% block content %}
<table class="table"> {% render_table object_list %}
<tr>
<td>ID</td>
<td>name</td>
</tr>
{% for object in object_list %}
<tr>
<td>{{object.pk}}</td>
<td><a href="{{ object.get_absolute_url }}"> {{ object.name }}</a></td>
</tr>
{% endfor %}
</table>
<a class="btn btn-primary" href="{% url 'member:club_create' %}">New Club</a> <a class="btn btn-primary" href="{% url 'member:club_create' %}">New Club</a>
{% endblock %} {% endblock %}