diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo index 1df2497..ec48ec6 100644 Binary files a/locale/en/LC_MESSAGES/django.mo and b/locale/en/LC_MESSAGES/django.mo differ diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 2b168e8..3811b8f 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -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 \n" "Language-Team: LANGUAGE \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 "" diff --git a/locale/fi/LC_MESSAGES/django.mo b/locale/fi/LC_MESSAGES/django.mo index 8ebd296..a1860c5 100644 Binary files a/locale/fi/LC_MESSAGES/django.mo and b/locale/fi/LC_MESSAGES/django.mo differ diff --git a/locale/fi/LC_MESSAGES/django.po b/locale/fi/LC_MESSAGES/django.po index 34433c8..bcde704 100644 --- a/locale/fi/LC_MESSAGES/django.po +++ b/locale/fi/LC_MESSAGES/django.po @@ -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ä:" \ No newline at end of file +msgstr "Haasteita yhteensä:" + +#~ msgid "Applied for board" +#~ msgstr "Hakenut hallitukseen" diff --git a/webapp/tables.py b/webapp/tables.py index 540a5a8..465b92a 100644 --- a/webapp/tables.py +++ b/webapp/tables.py @@ -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) diff --git a/webapp/templates/kaehmy_export.html b/webapp/templates/kaehmy_export.html index 668ee68..7d30fea 100644 --- a/webapp/templates/kaehmy_export.html +++ b/webapp/templates/kaehmy_export.html @@ -9,7 +9,16 @@

{% trans "All applications" %}

- {{ table|safe }} +
+

{% trans "Board applications" %}

+ {{ board_table|safe }} +
+ +
+

{% trans "Non-board applications" %}

+ {{ non_board_table|safe }} +
+
{% trans "Front page" %}
diff --git a/webapp/views.py b/webapp/views.py index 125368c..4f9a527 100644 --- a/webapp/views.py +++ b/webapp/views.py @@ -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)