Skip to content
Snippets Groups Projects
Commit 57599f18 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

add django tables 2 and basic table layout

parent 81886377
No related branches found
No related tags found
No related merge requests found
import django_tables2 as tables
from opentech.apply.funds.models import ApplicationSubmission
class DashboardTable(tables.Table):
submit_time = tables.DateColumn(verbose_name="Submitted")
page = tables.Column(verbose_name="Fund")
class Meta:
model = ApplicationSubmission
fields = ('title', 'page', 'submit_time')
{% extends "base.html" %}
{% load render_table from django_tables2 %}
{% block content %}
<h1>Recieved Content</h1>
<h3>Track and explore recent submissions</h3>
<table>
{% for submission in applicationsubmission_list %}
<tr>
<td>
{{ submission.title }}
</td>
</tr>
{% empty %}
There are no submissions to review.
{% endfor %}
</table>
{% render_table object_list %}
{% endblock %}
......@@ -2,7 +2,14 @@ from django.views.generic import ListView
from opentech.apply.funds.models import ApplicationSubmission
from .tables import DashboardTable
class DashboardView(ListView):
model = ApplicationSubmission
template_name = 'dashboard/dashboard.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['object_list'] = DashboardTable(context['object_list'])
return context
......@@ -56,6 +56,7 @@ INSTALLED_APPS = [
'django_extensions',
'captcha',
'wagtailcaptcha',
'django_tables2',
'django.contrib.admin',
'django.contrib.auth',
......
......@@ -13,6 +13,7 @@ wagtail_factories==0.3.0
flake8
social_auth_app_django==2.1.0
django-tables2=1.17.1
# Production dependencies
dj-database-url==0.4.1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment