diff --git a/AKModel/locale/de_DE/LC_MESSAGES/django.po b/AKModel/locale/de_DE/LC_MESSAGES/django.po index 78ed2a07a9d5b8d4d49d146590cebae18859c6c5..6c91a57b5bdd915de26ba250e65642e528afd773 100644 --- a/AKModel/locale/de_DE/LC_MESSAGES/django.po +++ b/AKModel/locale/de_DE/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-18 13:01+0000\n" +"POT-Creation-Date: 2019-10-20 17:51+0000\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" @@ -11,13 +11,13 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: availability.py:38 models.py:20 models.py:40 models.py:104 models.py:152 -#: models.py:183 models.py:208 +#: availability.py:38 models.py:20 models.py:40 models.py:105 models.py:153 +#: models.py:184 models.py:209 msgid "Event" msgstr "Event" -#: availability.py:39 models.py:41 models.py:105 models.py:153 models.py:184 -#: models.py:209 +#: availability.py:39 models.py:41 models.py:106 models.py:154 models.py:185 +#: models.py:210 msgid "Associated event" msgstr "Zugehöriges Event" @@ -29,7 +29,7 @@ msgstr "Person" msgid "Person whose availability this is" msgstr "Person deren Verfügbarkeit hier abgebildet wird" -#: availability.py:56 models.py:187 models.py:202 +#: availability.py:56 models.py:188 models.py:203 msgid "Room" msgstr "Raum" @@ -37,7 +37,7 @@ msgstr "Raum" msgid "Room whose availability this is" msgstr "Raum dessen Verfügbarkeit hier abgebildet wird" -#: availability.py:65 models.py:156 models.py:201 +#: availability.py:65 models.py:157 models.py:202 msgid "AK" msgstr "AK" @@ -47,7 +47,7 @@ msgstr "AK" msgid "AK whose availability this is" msgstr "Verfügbarkeiten" -#: availability.py:74 models.py:62 +#: availability.py:74 models.py:63 msgid "AK Category" msgstr "AK Kategorie" @@ -63,8 +63,8 @@ msgstr "Verfügbarkeit" msgid "Availabilities" msgstr "Verfügbarkeiten" -#: models.py:9 models.py:58 models.py:73 models.py:88 models.py:102 -#: models.py:119 models.py:176 +#: models.py:9 models.py:58 models.py:74 models.py:89 models.py:103 +#: models.py:120 models.py:177 msgid "Name" msgstr "Name" @@ -142,7 +142,7 @@ msgstr "Instutution" msgid "Uni etc." msgstr "Universität o.ä." -#: models.py:38 models.py:128 +#: models.py:38 models.py:129 msgid "Web Link" msgstr "Internet Link" @@ -162,231 +162,235 @@ msgstr "AK Leitungen" msgid "Name of the AK Category" msgstr "Name des AK Kategorie" -#: models.py:59 models.py:74 +#: models.py:59 models.py:75 msgid "Color" msgstr "Farbe" -#: models.py:59 models.py:74 +#: models.py:59 models.py:75 msgid "Color for displaying" msgstr "Farbe für die Anzeige" -#: models.py:63 +#: models.py:60 models.py:123 +msgid "Description" +msgstr "Beschreibung" + +#: models.py:60 +msgid "Short description of this AK Category" +msgstr "Beschreibung der AK-Kategorie" + +#: models.py:64 msgid "AK Categories" msgstr "AK Kategorien" -#: models.py:73 +#: models.py:74 msgid "Name of the AK Track" msgstr "Name des AK Tracks" -#: models.py:77 +#: models.py:78 msgid "AK Track" msgstr "AK Track" -#: models.py:78 +#: models.py:79 msgid "AK Tracks" msgstr "AK Tracks" -#: models.py:88 +#: models.py:89 msgid "Name of the AK Tag" msgstr "Name das AK Tags" -#: models.py:91 +#: models.py:92 msgid "AK Tag" msgstr "AK Tag" -#: models.py:92 +#: models.py:93 msgid "AK Tags" msgstr "AK Tags" -#: models.py:102 +#: models.py:103 msgid "Name of the Requirement" msgstr "Name der Anforderung" -#: models.py:108 +#: models.py:109 msgid "AK Requirement" msgstr "AK Anforderung" -#: models.py:109 +#: models.py:110 msgid "AK Requirements" msgstr "AK Anforderungen" -#: models.py:119 +#: models.py:120 msgid "Name of the AK" msgstr "Name des AKs" -#: models.py:120 +#: models.py:121 msgid "Short Name" msgstr "Kurzer Name" -#: models.py:121 +#: models.py:122 msgid "Name displayed in the schedule" msgstr "Name zur Anzeige im AK Plan" -#: models.py:122 -msgid "Description" -msgstr "Beschreibung" - -#: models.py:122 +#: models.py:123 msgid "Description of the AK" msgstr "Beschreibung des AKs" -#: models.py:124 +#: models.py:125 msgid "Owners" msgstr "Leitungen" -#: models.py:125 +#: models.py:126 msgid "Those organizing the AK" msgstr "Menschen, die den AK organisieren und halten" -#: models.py:128 +#: models.py:129 msgid "Link to wiki page" msgstr "Link zur Wiki Seite" -#: models.py:130 +#: models.py:131 msgid "Category" msgstr "Kategorie" -#: models.py:131 +#: models.py:132 msgid "Category of the AK" msgstr "Kategorie des AKs" -#: models.py:132 +#: models.py:133 msgid "Tags" msgstr "Tags" -#: models.py:132 +#: models.py:133 msgid "Tags provided by owners" msgstr "Tags, die durch die AK Leitung vergeben wurden" -#: models.py:133 +#: models.py:134 msgid "Track" msgstr "Track" -#: models.py:134 +#: models.py:135 msgid "Track the AK belongs to" msgstr "Track zu dem der AK gehört" -#: models.py:136 +#: models.py:137 msgid "Resolution Intention" msgstr "Resolutionsabsicht" -#: models.py:137 +#: models.py:138 msgid "Intends to submit a resolution" msgstr "Beabsichtigt eine Resolution einzureichen" -#: models.py:138 +#: models.py:139 msgid "Present this AK" msgstr "AK Präsentieren" -#: models.py:138 +#: models.py:139 msgid "Present results of this AK" msgstr "Die Ergebnisse dieses AKs vorstellen" -#: models.py:140 +#: models.py:141 msgid "Requirements" msgstr "Anforderungen" -#: models.py:141 +#: models.py:142 msgid "AK's Requirements" msgstr "Anforderungen des AKs" -#: models.py:143 +#: models.py:144 msgid "Conflicting AKs" msgstr "AK Konflikte" -#: models.py:144 +#: models.py:145 msgid "AKs that conflict and thus must not take place at the same time" msgstr "" "AKs, die Konflikte haben und deshalb nicht gleichzeitig stattfinden dürfen" -#: models.py:145 +#: models.py:146 msgid "Prerequisite AKs" msgstr "Vorausgesetzte AKs" -#: models.py:146 +#: models.py:147 msgid "AKs that should precede this AK in the schedule" msgstr "AKS die im AK Plan vor diesem AK stattfinden müssen" -#: models.py:148 +#: models.py:149 msgid "Internal Notes" msgstr "Interne Notizen" -#: models.py:148 +#: models.py:149 msgid "Notes to organizers" msgstr "Notizen an die Organisator*innen" -#: models.py:150 +#: models.py:151 msgid "Interest" msgstr "Interesse" -#: models.py:150 +#: models.py:151 msgid "Expected number of people" msgstr "Erwartete Personenzahl" -#: models.py:157 +#: models.py:158 msgid "AKs" msgstr "AKs" -#: models.py:176 +#: models.py:177 msgid "Name or number of the room" msgstr "Name oder Nummer des Raums" -#: models.py:177 +#: models.py:178 msgid "Building" msgstr "Gebäude" -#: models.py:178 +#: models.py:179 msgid "Name or number of the building" msgstr "Name oder Nummer des Gebäudes" -#: models.py:179 +#: models.py:180 msgid "Capacity" msgstr "Kapazität" -#: models.py:179 +#: models.py:180 msgid "Maximum number of people" msgstr "Maximale Personenzahl" -#: models.py:180 +#: models.py:181 msgid "Properties" msgstr "Eigenschaften" -#: models.py:181 +#: models.py:182 msgid "AK requirements fulfilled by the room" msgstr "AK Anforderungen, die dieser Raum erfüllt" -#: models.py:188 +#: models.py:189 msgid "Rooms" msgstr "Räume" -#: models.py:201 +#: models.py:202 msgid "AK being mapped" msgstr "AK, der zugeordnet wird" -#: models.py:203 +#: models.py:204 msgid "Room the AK will take place in" msgstr "Raum in dem der AK stattfindet" -#: models.py:204 +#: models.py:205 msgid "Slot Begin" msgstr "Beginn des Slots" -#: models.py:204 +#: models.py:205 msgid "Time and date the slot begins" msgstr "Zeit und Datum zu der der AK beginnt" -#: models.py:205 +#: models.py:206 msgid "Duration" msgstr "Dauer" -#: models.py:206 +#: models.py:207 msgid "Length in hours" msgstr "Länge in Stunden" -#: models.py:212 +#: models.py:213 msgid "AK Slot" msgstr "AK Slot" -#: models.py:213 +#: models.py:214 msgid "AK Slots" msgstr "AK Slot" diff --git a/AKModel/migrations/0016_category_description.py b/AKModel/migrations/0016_category_description.py new file mode 100644 index 0000000000000000000000000000000000000000..7b1ae9882894560bb37c6709d9b41d70957a938d --- /dev/null +++ b/AKModel/migrations/0016_category_description.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.6 on 2019-10-20 17:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('AKModel', '0015_ak_present_field'), + ] + + operations = [ + migrations.AddField( + model_name='akcategory', + name='description', + field=models.TextField(blank=True, help_text='Short description of this AK Category', verbose_name='Description'), + ), + ] diff --git a/AKModel/migrations/0017_owner_slug.py b/AKModel/migrations/0017_owner_slug.py index 39ef4b69c1983628a6bf90d9028ac88ceda672ee..c4fbb31bf88f41938b1687c80df961f64ee3a828 100644 --- a/AKModel/migrations/0017_owner_slug.py +++ b/AKModel/migrations/0017_owner_slug.py @@ -2,6 +2,15 @@ from django.db import migrations, models +from AKModel.models import AKOwner + + +def migrate_data_forward(apps, schema_editor): + for instance in AKOwner.objects.all(): + if instance.slug == '': + instance.slug = instance._generate_slug() + instance.save() # Will trigger slug update + class Migration(migrations.Migration): @@ -13,11 +22,20 @@ class Migration(migrations.Migration): migrations.AddField( model_name='akowner', name='slug', - field=models.SlugField(blank=True, help_text='Slug for URL generation', max_length=64, unique=True, verbose_name='Slug'), + field=models.SlugField(blank=True, help_text='Slug for URL generation', max_length=64, verbose_name='Slug'), ), migrations.AlterField( model_name='akowner', name='name', field=models.CharField(help_text='Name to identify an AK owner by', max_length=64, verbose_name='Nickname'), ), + migrations.RunPython( + migrate_data_forward, + migrations.RunPython.noop, + ), + migrations.AlterField( + model_name='akowner', + name='slug', + field=models.SlugField(blank=True, help_text='Slug for URL generation', unique=True, max_length=64, verbose_name='Slug') + ) ] diff --git a/AKModel/migrations/0018_merge_20191023_2227.py b/AKModel/migrations/0018_merge_20191023_2227.py new file mode 100644 index 0000000000000000000000000000000000000000..a1bcb9bed9461f2671c73c5a90492727b3b9d0fd --- /dev/null +++ b/AKModel/migrations/0018_merge_20191023_2227.py @@ -0,0 +1,14 @@ +# Generated by Django 2.2.6 on 2019-10-23 22:27 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('AKModel', '0016_category_description'), + ('AKModel', '0017_owner_slug'), + ] + + operations = [ + ] diff --git a/AKModel/models.py b/AKModel/models.py index aed1ffe322047b414a590bc6a683caec3438a0a1..81cb9ca46a12b87914220c6cceccbe6af23633c3 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -91,6 +91,7 @@ class AKCategory(models.Model): """ name = models.CharField(max_length=64, unique=True, verbose_name=_('Name'), help_text=_('Name of the AK Category')) color = models.CharField(max_length=7, blank=True, verbose_name=_('Color'), help_text=_('Color for displaying')) + description = models.TextField(blank=True, verbose_name=_("Description"), help_text=_("Short description of this AK Category")) class Meta: verbose_name = _('AK Category') diff --git a/AKPlanning/locale/de_DE/LC_MESSAGES/django.po b/AKPlanning/locale/de_DE/LC_MESSAGES/django.po new file mode 100644 index 0000000000000000000000000000000000000000..97d38e3a7aa7be726d93dee70bfb6e84686fd7fb --- /dev/null +++ b/AKPlanning/locale/de_DE/LC_MESSAGES/django.po @@ -0,0 +1,26 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-10-20 08:43+0000\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" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: settings.py:124 +msgid "German" +msgstr "Deutsch" + +#: settings.py:125 +msgid "English" +msgstr "Englisch" diff --git a/AKPlanning/settings.py b/AKPlanning/settings.py index 0c97a2482c9dd77b813a31e8be7c9dba816aa3fa..77fe20b2ce0a281d658230be15ff44f9242648d0 100644 --- a/AKPlanning/settings.py +++ b/AKPlanning/settings.py @@ -11,6 +11,8 @@ https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os +from django.utils.translation import gettext_lazy as _ + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -108,7 +110,7 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'en-US' TIME_ZONE = 'UTC' @@ -118,6 +120,11 @@ USE_L10N = True USE_TZ = True +LANGUAGES = [ + ('de', _('German')), + ('en', _('English')), +] + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ @@ -137,3 +144,6 @@ BOOTSTRAP4 = { # Settings for FontAwesome FONTAWESOME_CSS_URL = "//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css" + +# Treat wishes as seperate category in submission views? +WISHES_AS_CATEGORY = True diff --git a/AKPlanning/urls.py b/AKPlanning/urls.py index 959681e6f5d2539136861214732661eae9d55de3..44811231eedd374ffc76e36ea8f5446b5dd0df41 100644 --- a/AKPlanning/urls.py +++ b/AKPlanning/urls.py @@ -19,4 +19,5 @@ from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('AKSubmission.urls', namespace='submit')), + path('i18n/', include('django.conf.urls.i18n')), ] diff --git a/AKSubmission/locale/de_DE/LC_MESSAGES/django.po b/AKSubmission/locale/de_DE/LC_MESSAGES/django.po index 5650b7d858034a1a05c77a4194d21de363866f26..9c1e1d2830aebd978b4efcec8083ac111dd4b154 100644 --- a/AKSubmission/locale/de_DE/LC_MESSAGES/django.po +++ b/AKSubmission/locale/de_DE/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-19 00:30+0000\n" +"POT-Creation-Date: 2019-10-23 22:25+0000\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" @@ -22,13 +22,20 @@ msgstr "" #: templates/AKSubmission/ak_detail.html:18 #: templates/AKSubmission/ak_list.html:8 templates/AKSubmission/ak_list.html:13 #: templates/AKSubmission/ak_list.html:18 +#: templates/AKSubmission/akowner_create_select.html:13 #: templates/AKSubmission/submission_overview.html:6 #: templates/AKSubmission/submission_overview.html:11 #: templates/AKSubmission/submission_overview.html:15 -#: templates/AKSubmission/submit_new.html:12 +#: templates/AKSubmission/submit_new.html:13 +#: templates/AKSubmission/submit_new_wish.html:10 msgid "AK Submission" msgstr "AK-Eintragung" +#: templates/AKSubmission/ak_detail.html:29 +#: templates/AKSubmission/ak_list_table.html:30 +msgid "AK Wish" +msgstr "AK-Wunsch" + #: templates/AKSubmission/ak_detail.html:32 #: templates/AKSubmission/ak_list_table.html:10 msgid "Who?" @@ -85,6 +92,26 @@ msgstr "Diesen AK vorstellen" msgid "Reso" msgstr "Reso" +#: templates/AKSubmission/akowner_create_select.html:7 +#: templates/AKSubmission/akowner_create_select.html:19 +msgid "AK Owner" +msgstr "" + +#: templates/AKSubmission/akowner_create_select.html:25 +#: templates/AKSubmission/submit_new.html:27 +msgid "Reset" +msgstr "Zurücksetzen" + +#: templates/AKSubmission/akowner_create_select.html:29 +#: templates/AKSubmission/submit_new.html:31 +msgid "Cancel" +msgstr "Abbrechen" + +#: templates/AKSubmission/akowner_create_select.html:32 +#: templates/AKSubmission/submit_new.html:34 +msgid "Submit" +msgstr "Eintragen" + #: templates/AKSubmission/submission_overview.html:17 msgid "" "On this page you can see a list of current AKs, change them and add new ones." @@ -93,33 +120,33 @@ msgstr "" "bearbeiten und neue hinzufügen." #: templates/AKSubmission/submission_overview.html:20 -#: templates/AKSubmission/submit_new.html:29 -msgid "Submit" -msgstr "Eintragen" - -#: templates/AKSubmission/submission_overview.html:21 #: templates/AKSubmission/submit_new.html:7 -#: templates/AKSubmission/submit_new.html:13 -#: templates/AKSubmission/submit_new.html:18 +#: templates/AKSubmission/submit_new.html:15 +#: templates/AKSubmission/submit_new.html:21 msgid "New AK" msgstr "Neuer AK" -#: templates/AKSubmission/submission_overview.html:22 +#: templates/AKSubmission/submission_overview.html:21 +#: templates/AKSubmission/submit_new_wish.html:5 +#: templates/AKSubmission/submit_new_wish.html:12 +#: templates/AKSubmission/submit_new_wish.html:16 msgid "New AK Wish" msgstr "Neuer AK-Wunsch" -#: templates/AKSubmission/submission_overview.html:26 +#: templates/AKSubmission/submission_overview.html:25 msgid "Current AKs" msgstr "Aktuelle AKs" -#: templates/AKSubmission/submit_new.html:23 -msgid "Reset" -msgstr "Zurücksetzen" +#: views.py:43 +msgid "Wishes" +msgstr "Wünsche" -#: templates/AKSubmission/submit_new.html:26 -msgid "Cancel" -msgstr "Abbrechen" +#: views.py:43 +msgid "AKs one would like to have" +msgstr "" +"AKs die sich gewünscht wurden, aber bei denen noch nicht klar ist, wer sie " +"macht. Falls du dir das vorstellen kannst, trag dich einfach ein" -#: views.py:71 +#: views.py:106 msgid "AK successfully created" msgstr "AK erfolgreich angelegt" diff --git a/AKSubmission/templates/AKSubmission/ak_detail.html b/AKSubmission/templates/AKSubmission/ak_detail.html index 6e7a81df1a12f44d4f7716e768f89221bc20f29e..7c2ba070e28a0e3dbd46a82cec196ca78b9eb2f0 100644 --- a/AKSubmission/templates/AKSubmission/ak_detail.html +++ b/AKSubmission/templates/AKSubmission/ak_detail.html @@ -26,7 +26,7 @@ <a href="#" class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a> </div> - <h2>{{ ak.name }}</h2> + <h2>{% if ak.wish %}{% trans "AK Wish" %}: {% endif %}{{ ak.name }}</h2> <table class="table table-borderless"> <tr><td>{% trans "Who?" %}</td><td>{{ ak.owners_list }}</td></tr> diff --git a/AKSubmission/templates/AKSubmission/ak_list_table.html b/AKSubmission/templates/AKSubmission/ak_list_table.html index 275bbc7cfd9e37c6061e5230c27e16b864788647..4f5d25cfc568d500526dd497eb02b15ebdd60004 100644 --- a/AKSubmission/templates/AKSubmission/ak_list_table.html +++ b/AKSubmission/templates/AKSubmission/ak_list_table.html @@ -25,7 +25,13 @@ <span class="badge badge-dark badge-pill" title="{% trans 'Reso' %}">{% fontawesome_icon "scroll" %}</span> {% endif %} </td> - <td>{{ ak.owners_list }}</td> + <td> + {% if ak.wish %} + <span class="badge badge-dark badge-pill">{% trans "AK Wish" %}</span> + {% else %} + {{ ak.owners_list }} + {% endif %} + </td> <td>{% category_linked_badge ak.category event.slug %}</td> <td>{% tag_list ak.tags.all event.slug %}</td> <td class="text-right"> diff --git a/AKSubmission/templates/AKSubmission/submission_overview.html b/AKSubmission/templates/AKSubmission/submission_overview.html index 16f890097ef64d4020563251aa3b27a6a9a629da..60eaf2bd75f07fcfcef5acee8dc7126cea08f9b8 100644 --- a/AKSubmission/templates/AKSubmission/submission_overview.html +++ b/AKSubmission/templates/AKSubmission/submission_overview.html @@ -24,6 +24,25 @@ <h2>{% trans "Current AKs" %}</h2> - {% include "AKSubmission/ak_list_table.html" %} + <noscript> + {% include "AKSubmission/ak_list_table.html" %} + </noscript> + + <ul class="nav nav-tabs" style="margin-bottom:15px"> + {% for category, _ in categories %} + <li class="nav-item"> + <a class="nav-link {% if forloop.first %}active{% endif %}" data-toggle="tab" href="#category_{{ category.pk }}">{{ category.name }}</a> + </li> + {% endfor %} + </ul> + + <div id="akListTabbed" class="tab-content"> + {% for category, AKs in categories %} + <div class="tab-pane fade {% if forloop.first %}show active{% endif %}" id="category_{{ category.pk }}"> + <p><b>{{ category.name }}:</b> {{ category.description }}</p> + {% include "AKSubmission/ak_list_table.html" %} + </div> + {% endfor %} + </div> {% endblock %} diff --git a/AKSubmission/views.py b/AKSubmission/views.py index 90e1a96421595ba95fb31a82ba15bb840c8f736b..ad83df3a124ffae5c5e9da56c624b38510b0d660 100644 --- a/AKSubmission/views.py +++ b/AKSubmission/views.py @@ -8,8 +8,11 @@ from AKModel.models import AK, AKCategory, AKTag, AKOwner from AKModel.models import Event from AKModel.views import EventSlugMixin from AKModel.views import FilterByEventSlugMixin + from AKSubmission.forms import AKForm, AKWishForm, AKOwnerForm +from django.conf import settings + class SubmissionOverviewView(FilterByEventSlugMixin, ListView): model = AK @@ -17,6 +20,30 @@ class SubmissionOverviewView(FilterByEventSlugMixin, ListView): template_name = "AKSubmission/submission_overview.html" ordering = ['category'] + def get_context_data(self, *, object_list=None, **kwargs): + context = super().get_context_data(object_list=object_list, **kwargs) + + # Sort AKs into different lists (by their category) + categories = [] + aks_for_category = [] + ak_wishes = [] + current_category = None + for ak in context["AKs"]: + if ak.category != current_category: + current_category = ak.category + aks_for_category = [] + categories.append((current_category, aks_for_category)) + if settings.WISHES_AS_CATEGORY and ak.wish: + ak_wishes.append(ak) + else: + aks_for_category.append(ak) + + if settings.WISHES_AS_CATEGORY: + categories.append(({"name":_("Wishes"), "pk": "wish", "description": _("AKs one would like to have")}, ak_wishes)) + context["categories"] = categories + + return context + class AKDetailView(DetailView): model = AK diff --git a/README.md b/README.md index 48eb11ec061e117c4625175c0861b06449ad5afe..79d82835a287e61d4a79c0023e051220ea58ef0f 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,8 @@ Python requirements are listed in ``requirements.txt``. They can be installed wi 1. activate virtualenv ``source env/bin/activate`` 1. install python requirements ``pip install -r requirements.txt`` 1. setup necessary database tables etc. ``python manage.py migrate`` +1. prepare static files (can be omitted for dev setups) ``python manage.py collectstatic`` +1. compile translations ``python manage.py compilemessages`` 1. create a priviledged user, credentials are entered interactively on CLI ``python manage.py createsuperuser`` 1. deactivate virtualenv ``deactivate`` diff --git a/Utils/setup.sh b/Utils/setup.sh index 7e9d7a2ac0efdb278f18ffa0796fb9e127888f3e..ba0a5aa032e2793652515b0abaa3ab081b7f933b 100755 --- a/Utils/setup.sh +++ b/Utils/setup.sh @@ -18,6 +18,10 @@ pip install -r requirements.txt # Setup database python manage.py migrate +# Prepare static files and translations +python manage.py collectstatic --noinput +python manage.py compilemessages + # Create superuser # Credentials are entered interactively on CLI python manage.py createsuperuser diff --git a/Utils/update.sh b/Utils/update.sh index 240767427bb0f37243481ee45e3f583ccd3bc534..e1568893eb2d44c5bbebb761cd74c266c01d9148 100755 --- a/Utils/update.sh +++ b/Utils/update.sh @@ -24,4 +24,6 @@ if [ "$1" = "--prod" ]; then fi ./manage.py migrate +./manage.py collectstatic --noinput +./manage.py compilemessages touch AKPlanning/wsgi.py diff --git a/templates/base.html b/templates/base.html index 669bd80611e7bd53483c828ae4340198111d5c29..8ff7b8a65d101a1890b3abf30af83c54d72fad02 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,4 +1,5 @@ {% load static %} +{% load i18n %} {% load bootstrap4 %} {% load fontawesome %} @@ -15,8 +16,39 @@ </head> <body> + {% block language-switcher %} + <!-- language switcher --> + <div class="container" style="margin-top:20px"> + <form action="{% url 'set_language' %}" + method="post" + class="form-inline" + name="language-form" + style="flex-direction: column;"> + {% csrf_token %} - <div class="container" style="margin-top:20px;margin-bottom: 30px;"> + <input name="next" type="hidden" value="{{ request.path }}" /> + + {% get_current_language as LANGUAGE_CODE %} + {% get_available_languages as LANGUAGES %} + {% get_language_info_list for LANGUAGES as languages %} + + <div style="align-self: end;"> + {% for language in languages %} + + <button type="submit" + class="btn {% if language.code == LANGUAGE_CODE %}btn-info{% else %}btn-outline-info{% endif %}" + name="language" + value="{{ language.code }}" + style="align-self: end;"> + {{ language.code | upper }} + </button> + {% endfor %} + </div> + </form> + </div> + {% endblock %} + + <div class="container" style="margin-top:15px;margin-bottom: 30px;"> <ol class="breadcrumb"> {% block breadcrumbs %} {% endblock %}