Split board and non-board applications to 2 tables

This commit is contained in:
Jan Tuomi
2017-10-30 14:43:16 +02:00
parent 2285bf02a9
commit 2501d034db
7 changed files with 59 additions and 31 deletions
Binary file not shown.
+15 -7
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-30 11:39+0100\n" "POT-Creation-Date: 2017-10-30 13:41+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -818,7 +818,7 @@ msgstr ""
msgid "Role" msgid "Role"
msgstr "" msgstr ""
#: .\webapp\models.py:251 .\webapp\tables.py:16 #: .\webapp\models.py:251 .\webapp\tables.py:18
msgid "Roles" msgid "Roles"
msgstr "" msgstr ""
@@ -846,10 +846,6 @@ msgstr ""
msgid "Telegram channels" msgid "Telegram channels"
msgstr "" msgstr ""
#: .\webapp\tables.py:17
msgid "Applied for board"
msgstr ""
#: .\webapp\templates\admin_index.html:6 #: .\webapp\templates\admin_index.html:6
msgid "SIK Admin" msgid "SIK Admin"
msgstr "SIK Admin" msgstr "SIK Admin"
@@ -938,7 +934,19 @@ msgstr "Election meeting, part 3 (non-board election)"
msgid "All applications" msgid "All applications"
msgstr "Applications" msgstr "Applications"
#: .\webapp\templates\kaehmy_export.html:14 #: .\webapp\templates\kaehmy_export.html:13
#, fuzzy
#| msgid "Applications"
msgid "Board applications"
msgstr "Applications"
#: .\webapp\templates\kaehmy_export.html:18
#, fuzzy
#| msgid "Member applications"
msgid "Non-board applications"
msgstr "Member applications"
#: .\webapp\templates\kaehmy_export.html:23
msgid "Front page" msgid "Front page"
msgstr "" msgstr ""
Binary file not shown.
+15 -8
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-30 11:39+0100\n" "POT-Creation-Date: 2017-10-30 13:41+0100\n"
"PO-Revision-Date: 2017-10-29 11:57+0200\n" "PO-Revision-Date: 2017-10-30 14:42+0200\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: fi\n" "Language: fi\n"
@@ -799,7 +799,7 @@ msgstr "Toimari: {}"
msgid "Role" msgid "Role"
msgstr "Rooli" msgstr "Rooli"
#: .\webapp\models.py:251 .\webapp\tables.py:16 #: .\webapp\models.py:251 .\webapp\tables.py:18
msgid "Roles" msgid "Roles"
msgstr "Roolit" msgstr "Roolit"
@@ -827,10 +827,6 @@ msgstr "Telegram-kanava"
msgid "Telegram channels" msgid "Telegram channels"
msgstr "Telegram-kanavat" msgstr "Telegram-kanavat"
#: .\webapp\tables.py:17
msgid "Applied for board"
msgstr "Hakenut hallitukseen"
#: .\webapp\templates\admin_index.html:6 #: .\webapp\templates\admin_index.html:6
msgid "SIK Admin" msgid "SIK Admin"
msgstr "SIK Hallintapaneeli" msgstr "SIK Hallintapaneeli"
@@ -920,7 +916,15 @@ msgstr "Vaalikokous, osa 3 (toimarien valinta)"
msgid "All applications" msgid "All applications"
msgstr "Kaikki kaehmyt" msgstr "Kaikki kaehmyt"
#: .\webapp\templates\kaehmy_export.html:14 #: .\webapp\templates\kaehmy_export.html:13
msgid "Board applications"
msgstr "Hallituskaehmyt"
#: .\webapp\templates\kaehmy_export.html:18
msgid "Non-board applications"
msgstr "Toimarikaehmyt"
#: .\webapp\templates\kaehmy_export.html:23
msgid "Front page" msgid "Front page"
msgstr "Etusivulle" msgstr "Etusivulle"
@@ -1018,3 +1022,6 @@ msgstr "Kaikki haasteet"
#: .\webapp\templates\ohlhafv_list.html:15 #: .\webapp\templates\ohlhafv_list.html:15
msgid "Total challenges:" msgid "Total challenges:"
msgstr "Haasteita yhteensä:" msgstr "Haasteita yhteensä:"
#~ msgid "Applied for board"
#~ msgstr "Hakenut hallitukseen"
+4 -6
View File
@@ -1,5 +1,7 @@
import django_tables2 as tables import django_tables2 as tables
from django.db.models import Count, Q
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from webapp.models import OhlhafvChallenge, KaehmyForm from webapp.models import OhlhafvChallenge, KaehmyForm
@@ -11,10 +13,6 @@ class OhlhafvTable(tables.Table):
class KaehmyExportTable(tables.Table): class KaehmyExportTable(tables.Table):
class Meta: class Meta:
model = KaehmyForm model = KaehmyForm
exclude = ['text', 'messageparent_ptr', 'custom_role_name', 'custom_role_is_board'] exclude = ['text', 'messageparent_ptr', 'custom_role_name', 'custom_role_is_board', 'timestamp']
all_roles = tables.Column(verbose_name=_('Roles')) all_roles = tables.Column(verbose_name=_('Roles'), orderable=False)
has_any_board_role = tables.BooleanColumn(verbose_name=_('Applied for board'))
def __init__(self, *args, **kwargs):
super(KaehmyExportTable, self).__init__(*args, **kwargs)
+10 -1
View File
@@ -9,7 +9,16 @@
<h2 style="padding-top: 1rem">{% trans "All applications" %}</h2> <h2 style="padding-top: 1rem">{% trans "All applications" %}</h2>
</div> </div>
{{ table|safe }} <div>
<h4>{% trans "Board applications" %}</h4>
{{ board_table|safe }}
</div>
<div>
<h4>{% trans "Non-board applications" %}</h4>
{{ non_board_table|safe }}
</div>
<div> <div>
<a href="/kaehmy" class="btn btn-primary">{% trans "Front page" %}</a> <a href="/kaehmy" class="btn btn-primary">{% trans "Front page" %}</a>
</div> </div>
+14 -8
View File
@@ -319,16 +319,22 @@ def kaehmy_submit(request, *args, **kwargs):
@require_http_methods(['GET']) @require_http_methods(['GET'])
def kaehmy_export_view(request, *args, **kwargs): def kaehmy_export_view(request, *args, **kwargs):
def make_table(queryset):
table = KaehmyExportTable(queryset,
request=request,
exclude=['id'],
attrs={'class': 'table table-bordered table-hover'})
table.paginate(page=request.GET.get('page', 1), per_page=9999)
table_html = convert_table_to_html(table, request)
return table_html
kaehmys = KaehmyForm.objects.all() kaehmys = KaehmyForm.objects.all()
non_board = filter(lambda q: not q.has_any_board_role(), kaehmys)
board = filter(lambda q: q.has_any_board_role(), kaehmys)
table = KaehmyExportTable(kaehmys,
request=request,
exclude=['id'],
attrs={'class': 'table table-bordered table-hover'})
table.paginate(page=request.GET.get('page', 1), per_page=9999)
table_html = convert_table_to_html(table, request)
context = { context = {
'table': table_html, 'non_board_table': make_table(non_board),
'board_table': make_table(board),
} }
return render(request, 'kaehmy_export.html', context) return render(request, 'kaehmy_export.html', context)