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 ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -818,7 +818,7 @@ msgstr ""
msgid "Role"
msgstr ""
#: .\webapp\models.py:251 .\webapp\tables.py:16
#: .\webapp\models.py:251 .\webapp\tables.py:18
msgid "Roles"
msgstr ""
@@ -846,10 +846,6 @@ msgstr ""
msgid "Telegram channels"
msgstr ""
#: .\webapp\tables.py:17
msgid "Applied for board"
msgstr ""
#: .\webapp\templates\admin_index.html:6
msgid "SIK Admin"
msgstr "SIK Admin"
@@ -938,7 +934,19 @@ msgstr "Election meeting, part 3 (non-board election)"
msgid "All 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"
msgstr ""
Binary file not shown.
+16 -9
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-30 11:39+0100\n"
"PO-Revision-Date: 2017-10-29 11:57+0200\n"
"POT-Creation-Date: 2017-10-30 13:41+0100\n"
"PO-Revision-Date: 2017-10-30 14:42+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fi\n"
@@ -799,7 +799,7 @@ msgstr "Toimari: {}"
msgid "Role"
msgstr "Rooli"
#: .\webapp\models.py:251 .\webapp\tables.py:16
#: .\webapp\models.py:251 .\webapp\tables.py:18
msgid "Roles"
msgstr "Roolit"
@@ -827,10 +827,6 @@ msgstr "Telegram-kanava"
msgid "Telegram channels"
msgstr "Telegram-kanavat"
#: .\webapp\tables.py:17
msgid "Applied for board"
msgstr "Hakenut hallitukseen"
#: .\webapp\templates\admin_index.html:6
msgid "SIK Admin"
msgstr "SIK Hallintapaneeli"
@@ -920,7 +916,15 @@ msgstr "Vaalikokous, osa 3 (toimarien valinta)"
msgid "All applications"
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"
msgstr "Etusivulle"
@@ -1017,4 +1021,7 @@ msgstr "Kaikki haasteet"
#: .\webapp\templates\ohlhafv_list.html:15
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
from django.db.models import Count, Q
from django.utils.translation import ugettext as _
from webapp.models import OhlhafvChallenge, KaehmyForm
@@ -11,10 +13,6 @@ class OhlhafvTable(tables.Table):
class KaehmyExportTable(tables.Table):
class Meta:
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'))
has_any_board_role = tables.BooleanColumn(verbose_name=_('Applied for board'))
def __init__(self, *args, **kwargs):
super(KaehmyExportTable, self).__init__(*args, **kwargs)
all_roles = tables.Column(verbose_name=_('Roles'), orderable=False)
+10 -1
View File
@@ -9,7 +9,16 @@
<h2 style="padding-top: 1rem">{% trans "All applications" %}</h2>
</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>
<a href="/kaehmy" class="btn btn-primary">{% trans "Front page" %}</a>
</div>
+14 -8
View File
@@ -319,16 +319,22 @@ def kaehmy_submit(request, *args, **kwargs):
@require_http_methods(['GET'])
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()
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 = {
'table': table_html,
'non_board_table': make_table(non_board),
'board_table': make_table(board),
}
return render(request, 'kaehmy_export.html', context)