Skip to content
Snippets Groups Projects
Commit 70569913 authored by Benjamin Hättasch's avatar Benjamin Hättasch Committed by Nadja Geisler
Browse files

Prevent too long URLs for AKs

Truncate the length of the AK url if the title is too long and inform the user
This resolves #142
parent 40ce509c
No related branches found
No related tags found
1 merge request!123Fix smaller issues
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-29 13:36+0000\n"
"POT-Creation-Date: 2022-08-13 18:04+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"
......@@ -428,39 +428,45 @@ msgstr "Event inaktiv. Hinzufügen/Bearbeiten nicht möglich."
msgid "AK successfully created"
msgstr "AK erfolgreich angelegt"
#: AKSubmission/views.py:267
#: AKSubmission/views.py:227
msgid ""
"Due to technical reasons, the link you entered was truncated to a length of "
"200 characters"
msgstr "Aus technischen Gründen wurde der eingegebeneLink auf eine Länge von 200 Zeichen gekürzt"
#: AKSubmission/views.py:272
msgid "AK successfully updated"
msgstr "AK erfolgreich aktualisiert"
#: AKSubmission/views.py:334
#: AKSubmission/views.py:339
msgid "Person Info successfully updated"
msgstr "Personen-Info erfolgreich aktualisiert"
#: AKSubmission/views.py:354
#: AKSubmission/views.py:359
msgid "No user selected"
msgstr "Keine Person ausgewählt"
#: AKSubmission/views.py:380
#: AKSubmission/views.py:385
msgid "AK Slot successfully added"
msgstr "AK-Slot erfolgreich angelegt"
#: AKSubmission/views.py:394
#: AKSubmission/views.py:399
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:404
#: AKSubmission/views.py:409
msgid "AK Slot successfully updated"
msgstr "AK-Slot erfolgreich aktualisiert"
#: AKSubmission/views.py:417
#: AKSubmission/views.py:422
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:427
#: AKSubmission/views.py:432
msgid "AK Slot successfully deleted"
msgstr "AK-Slot erfolgreich angelegt"
#: AKSubmission/views.py:448
#: AKSubmission/views.py:454
msgid "Message to organizers successfully saved"
msgstr "Nachricht an die Organisator*innen erfolgreich gespeichert"
......
......@@ -219,12 +219,17 @@ class AKAndAKWishSubmissionView(EventSlugMixin, EventInactiveRedirectMixin, Crea
# Generate wiki link
if form.cleaned_data["event"].base_url:
self.object.link = form.cleaned_data["event"].base_url + form.cleaned_data["name"].replace(" ", "_")
link = form.cleaned_data["event"].base_url + form.cleaned_data["name"].replace(" ", "_")
# Truncate links longer than 200 characters (default length of URL fields in django)
self.object.link = link[:200]
if len(link) > 200:
messages.add_message(self.request, messages.WARNING,
_("Due to technical reasons, the link you entered was truncated to a length of 200 characters"))
self.object.save()
# Set tags (and generate them if necessary)
for tag_name in form.cleaned_data["tag_names"]:
tag, _ = AKTag.objects.get_or_create(name=tag_name)
tag, was_created = AKTag.objects.get_or_create(name=tag_name)
self.object.tags.add(tag)
# Generate slot(s)
......@@ -280,7 +285,7 @@ class AKEditView(EventSlugMixin, EventInactiveRedirectMixin, UpdateView):
# Set tags (and generate them if necessary)
for tag_name in form.cleaned_data["tag_names"]:
tag, _ = AKTag.objects.get_or_create(name=tag_name)
tag, was_created = AKTag.objects.get_or_create(name=tag_name)
self.object.tags.add(tag)
return super_form_valid
......
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