Skip to content
Snippets Groups Projects
Commit 0d7f7870 authored by Nadja Geisler's avatar Nadja Geisler :sunny:
Browse files

Merge branch 'fix-event-inactive' into 'master'

Prevent creating and editing in submission for inactive events

Closes #21

See merge request kif/akplanning!25
parents 46adcb58 8ada54c9
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-11 20:45+0000\n"
"POT-Creation-Date: 2020-05-11 22:27+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"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-11 20:45+0000\n"
"POT-Creation-Date: 2020-05-11 22:27+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"
......@@ -40,31 +40,31 @@ msgstr "Veranstaltung"
msgid "Room"
msgstr "Raum"
#: AKPlan/templates/AKPlan/plan_index.html:81
#: AKPlan/templates/AKPlan/plan_index.html:82
#: AKPlan/templates/AKPlan/plan_room.html:34
msgid "Rooms"
msgstr "Räume"
#: AKPlan/templates/AKPlan/plan_index.html:91
#: AKPlan/templates/AKPlan/plan_index.html:94
#: AKPlan/templates/AKPlan/plan_track.html:34
msgid "Tracks"
msgstr "Tracks"
#: AKPlan/templates/AKPlan/plan_index.html:102
#: AKPlan/templates/AKPlan/plan_index.html:106
msgid "AK Wall"
msgstr "AK-Wall"
#: AKPlan/templates/AKPlan/plan_index.html:114
#: AKPlan/templates/AKPlan/plan_index.html:118
#: AKPlan/templates/AKPlan/plan_wall.html:88
msgid "Current AKs"
msgstr "Aktuelle AKs"
#: AKPlan/templates/AKPlan/plan_index.html:121
#: AKPlan/templates/AKPlan/plan_index.html:125
#: AKPlan/templates/AKPlan/plan_wall.html:93
msgid "Next AKs"
msgstr "Nächste AKs"
#: AKPlan/templates/AKPlan/plan_index.html:129
#: AKPlan/templates/AKPlan/plan_index.html:133
msgid "This event is not active."
msgstr "Dieses Event ist nicht aktiv."
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-10 16:22+0000\n"
"POT-Creation-Date: 2020-05-11 22:27+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"
......@@ -17,10 +17,10 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: AKPlanning/settings.py:126
#: AKPlanning/settings.py:127
msgid "German"
msgstr "Deutsch"
#: AKPlanning/settings.py:127
#: AKPlanning/settings.py:128
msgid "English"
msgstr "Englisch"
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-11 20:45+0000\n"
"POT-Creation-Date: 2020-05-11 22:27+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"
......@@ -73,64 +73,64 @@ msgstr "AK-Eintragung"
msgid "Interest"
msgstr "Interesse"
#: AKSubmission/templates/AKSubmission/ak_detail.html:43
#: AKSubmission/templates/AKSubmission/ak_detail.html:45
#: AKSubmission/templates/AKSubmission/ak_list_table.html:32
msgid "AK Wish"
msgstr "AK-Wunsch"
#: AKSubmission/templates/AKSubmission/ak_detail.html:47
#: AKSubmission/templates/AKSubmission/ak_detail.html:49
#: AKSubmission/templates/AKSubmission/ak_list_table.html:10
msgid "Who?"
msgstr "Wer?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:51
#: AKSubmission/templates/AKSubmission/ak_detail.html:53
#: AKSubmission/templates/AKSubmission/ak_list_table.html:11
msgid "Category"
msgstr "Kategorie"
#: AKSubmission/templates/AKSubmission/ak_detail.html:57
#: AKSubmission/templates/AKSubmission/ak_detail.html:59
msgid "Present this AK"
msgstr "Diesen AK vorstellen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:61
#: AKSubmission/templates/AKSubmission/ak_detail.html:63
#: AKSubmission/templates/AKSubmission/ak_list_table.html:12
msgid "Tags"
msgstr "Tags"
#: AKSubmission/templates/AKSubmission/ak_detail.html:67
#: AKSubmission/templates/AKSubmission/ak_detail.html:69
msgid "Reso?"
msgstr "Reso?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:74
#: AKSubmission/templates/AKSubmission/ak_detail.html:76
msgid "Requirements"
msgstr "Anforderungen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:87
#: AKSubmission/templates/AKSubmission/ak_detail.html:89
msgid "Conflicting AKs"
msgstr "AK Konflikte"
#: AKSubmission/templates/AKSubmission/ak_detail.html:95
#: AKSubmission/templates/AKSubmission/ak_detail.html:97
msgid "Prerequisite AKs"
msgstr "AK Voraussetzungen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:103
#: AKSubmission/templates/AKSubmission/ak_detail.html:105
msgid "Notes"
msgstr "Notizen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:120
#: AKSubmission/templates/AKSubmission/ak_detail.html:122
msgid "When?"
msgstr "Wann?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:121
#: AKSubmission/templates/AKSubmission/ak_detail.html:123
#: AKSubmission/templates/AKSubmission/akslot_delete.html:35
msgid "Duration"
msgstr "Dauer"
#: AKSubmission/templates/AKSubmission/ak_detail.html:122
#: AKSubmission/templates/AKSubmission/ak_detail.html:124
msgid "Room"
msgstr "Raum"
#: AKSubmission/templates/AKSubmission/ak_detail.html:148
#: AKSubmission/templates/AKSubmission/ak_detail.html:150
msgid "Add another slot"
msgstr "Einen neuen AK-Slot hinzufügen"
......@@ -270,38 +270,42 @@ 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"
#: AKSubmission/views.py:113
#: AKSubmission/views.py:109
msgid "Event inactive. Cannot create or update."
msgstr "Event inaktiv. Hinzufügen/Bearbeiten nicht möglich."
#: AKSubmission/views.py:125
msgid "AK successfully created"
msgstr "AK erfolgreich angelegt"
#: AKSubmission/views.py:166
#: AKSubmission/views.py:183
msgid "AK successfully updated"
msgstr "AK erfolgreich aktualisiert"
#: AKSubmission/views.py:233
#: AKSubmission/views.py:261
msgid "Person Info successfully updated"
msgstr "Personen-Info erfolgreich aktualisiert"
#: AKSubmission/views.py:246
#: AKSubmission/views.py:281
msgid "No user selected"
msgstr "Keine Person ausgewählt"
#: AKSubmission/views.py:272
#: AKSubmission/views.py:307
msgid "AK Slot successfully added"
msgstr "AK-Slot erfolgreich angelegt"
#: AKSubmission/views.py:286
#: AKSubmission/views.py:321
msgid "You cannot edit a slot that has already been scheduled"
msgstr "Bereits geplante AK-Slots können nicht mehr bearbeitet werden"
#: AKSubmission/views.py:296
#: AKSubmission/views.py:331
msgid "AK Slot successfully updated"
msgstr "AK-Slot erfolgreich aktualisiert"
#: AKSubmission/views.py:309
#: AKSubmission/views.py:344
msgid "You cannot delete a slot that has already been scheduled"
msgstr "Bereits geplante AK-Slots können nicht mehr gelöscht werden"
#: AKSubmission/views.py:319
#: AKSubmission/views.py:354
msgid "AK Slot successfully deleted"
msgstr "AK-Slot erfolgreich angelegt"
......@@ -28,8 +28,10 @@
<div class="float-right">
{% if ak.interest_counter >= 0 %}
{% trans 'Interest' %}: <b class='mx-1 text-muted'>{{ ak.interest_counter }}</b>
<a href="{% url 'submit:inc_interest' event_slug=ak.event.slug pk=ak.pk %}"
class="btn btn-primary">{% fa5_icon 'thumbs-up' 'fas' %}</a>
{% if ak.event.active %}
<a href="{% url 'submit:inc_interest' event_slug=ak.event.slug pk=ak.pk %}"
class="btn btn-primary">{% fa5_icon 'thumbs-up' 'fas' %}</a>
{% endif %}
{% endif %}
{% if ak.link != "" %}
<a href="{{ ak.link }}" class="btn btn-info">{% fa5_icon 'external-link-alt' 'fas' %}</a>
......
......@@ -104,7 +104,19 @@ class AKListByTrackView(AKListView):
return super().get_queryset().filter(track=self.track)
class AKAndAKWishSubmissionView(EventSlugMixin, CreateView):
class EventInactiveRedirectMixin:
def get_error_message(self):
return _("Event inactive. Cannot create or update.")
def get(self, request, *args, **kwargs):
s = super().get(request, *args, **kwargs)
if not self.event.active:
messages.add_message(self.request, messages.ERROR, self.get_error_message())
return redirect(reverse_lazy('submit:submission_overview', kwargs={'event_slug': self.event.slug}))
return s
class AKAndAKWishSubmissionView(EventSlugMixin, EventInactiveRedirectMixin, CreateView):
model = AK
template_name = 'AKSubmission/submit_new.html'
form_class = AKSubmissionForm
......@@ -114,6 +126,11 @@ class AKAndAKWishSubmissionView(EventSlugMixin, CreateView):
return reverse_lazy('submit:ak_detail', kwargs={'event_slug': self.kwargs['event_slug'], 'pk': self.object.pk})
def form_valid(self, form):
if not form.cleaned_data["event"].active:
messages.add_message(self.request, messages.ERROR, self.get_error_message())
return redirect(reverse_lazy('submit:submission_overview',
kwargs={'event_slug': form.cleaned_data["event"].slug}))
super_form_valid = super().form_valid(form)
# Generate wiki link
......@@ -157,7 +174,7 @@ class AKWishSubmissionView(AKAndAKWishSubmissionView):
return initials
class AKEditView(EventSlugMixin, UpdateView):
class AKEditView(EventSlugMixin, EventInactiveRedirectMixin, UpdateView):
model = AK
template_name = 'AKSubmission/ak_edit.html'
form_class = AKEditForm
......@@ -167,6 +184,11 @@ class AKEditView(EventSlugMixin, UpdateView):
return reverse_lazy('submit:ak_detail', kwargs={'event_slug': self.kwargs['event_slug'], 'pk': self.object.pk})
def form_valid(self, form):
if not form.cleaned_data["event"].active:
messages.add_message(self.request, messages.ERROR, self.get_error_message())
return redirect(reverse_lazy('submit:submission_overview',
kwargs={'event_slug': form.cleaned_data["event"].slug}))
super_form_valid = super().form_valid(form)
# Detach existing tags
......@@ -186,13 +208,12 @@ class AKInterestView(RedirectView):
def get_redirect_url(self, *args, **kwargs):
ak = get_object_or_404(AK, pk=kwargs['pk'])
ak.increment_interest()
if ak.event.active:
ak.increment_interest()
return super().get_redirect_url(*args, **kwargs)
pass
class AKOwnerCreateView(EventSlugMixin, CreateView):
class AKOwnerCreateView(EventSlugMixin, EventInactiveRedirectMixin, CreateView):
model = AKOwner
template_name = 'AKSubmission/akowner_create_update.html'
form_class = AKOwnerForm
......@@ -206,6 +227,13 @@ class AKOwnerCreateView(EventSlugMixin, CreateView):
initials['event'] = self.event
return initials
def form_valid(self, form):
if not form.cleaned_data["event"].active:
messages.add_message(self.request, messages.ERROR, self.get_error_message())
return redirect(reverse_lazy('submit:submission_overview',
kwargs={'event_slug': form.cleaned_data["event"].slug}))
return super().form_valid(form)
class AKOwnerSelectDispatchView(EventSlugMixin, View):
"""
......@@ -224,7 +252,7 @@ class AKOwnerSelectDispatchView(EventSlugMixin, View):
reverse_lazy('submit:submit_ak', kwargs={'event_slug': kwargs['event_slug'], 'owner_slug': owner.slug}))
class AKOwnerEditView(FilterByEventSlugMixin, UpdateView):
class AKOwnerEditView(FilterByEventSlugMixin, EventSlugMixin, UpdateView):
model = AKOwner
template_name = "AKSubmission/akowner_create_update.html"
form_class = AKOwnerForm
......@@ -233,6 +261,13 @@ class AKOwnerEditView(FilterByEventSlugMixin, UpdateView):
messages.add_message(self.request, messages.SUCCESS, _("Person Info successfully updated"))
return reverse_lazy('submit:submission_overview', kwargs={'event_slug': self.kwargs['event_slug']})
def form_valid(self, form):
if not form.cleaned_data["event"].active:
messages.add_message(self.request, messages.ERROR, self.get_error_message())
return redirect(reverse_lazy('submit:submission_overview',
kwargs={'event_slug': form.cleaned_data["event"].slug}))
return super().form_valid(form)
class AKOwnerEditDispatchView(EventSlugMixin, View):
"""
......@@ -252,7 +287,7 @@ class AKOwnerEditDispatchView(EventSlugMixin, View):
reverse_lazy('submit:akowner_edit', kwargs={'event_slug': kwargs['event_slug'], 'slug': owner.slug}))
class AKSlotAddView(EventSlugMixin, CreateView):
class AKSlotAddView(EventSlugMixin, EventInactiveRedirectMixin, CreateView):
model = AKSlot
form_class = AKDurationForm
template_name = "AKSubmission/akslot_add_update.html"
......@@ -274,7 +309,7 @@ class AKSlotAddView(EventSlugMixin, CreateView):
kwargs={'event_slug': self.kwargs['event_slug'], 'pk': self.object.ak.pk})
class AKSlotEditView(EventSlugMixin, UpdateView):
class AKSlotEditView(EventSlugMixin, EventInactiveRedirectMixin, UpdateView):
model = AKSlot
form_class = AKDurationForm
template_name = "AKSubmission/akslot_add_update.html"
......@@ -298,7 +333,7 @@ class AKSlotEditView(EventSlugMixin, UpdateView):
kwargs={'event_slug': self.kwargs['event_slug'], 'pk': self.object.ak.pk})
class AKSlotDeleteView(EventSlugMixin, DeleteView):
class AKSlotDeleteView(EventSlugMixin, EventInactiveRedirectMixin, DeleteView):
model = AKSlot
template_name = "AKSubmission/akslot_delete.html"
......
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