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

Merge branch 'submission_form' into 'master'

Submission form

See merge request kif/akplanning!4
parents 1dc17247 8c77e29f
No related branches found
No related tags found
1 merge request!4Submission form
Showing
with 723 additions and 134 deletions
......@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-20 17:51+0000\n"
"POT-Creation-Date: 2019-10-24 22:48+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:105 models.py:153
#: models.py:184 models.py:209
#: availability.py:38 models.py:25 models.py:47 models.py:141 models.py:190
#: models.py:222 models.py:248
msgid "Event"
msgstr "Event"
#: availability.py:39 models.py:41 models.py:106 models.py:154 models.py:185
#: models.py:210
#: availability.py:39 models.py:48 models.py:142 models.py:191 models.py:223
#: models.py:249
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:188 models.py:203
#: availability.py:56 models.py:226 models.py:241
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:157 models.py:202
#: availability.py:65 models.py:194 models.py:240
msgid "AK"
msgstr "AK"
......@@ -47,7 +47,7 @@ msgstr "AK"
msgid "AK whose availability this is"
msgstr "Verfügbarkeiten"
#: availability.py:74 models.py:63
#: availability.py:74 models.py:99
msgid "AK Category"
msgstr "AK Kategorie"
......@@ -63,334 +63,354 @@ msgstr "Verfügbarkeit"
msgid "Availabilities"
msgstr "Verfügbarkeiten"
#: models.py:9 models.py:58 models.py:74 models.py:89 models.py:103
#: models.py:120 models.py:177
#: models.py:12 models.py:94 models.py:110 models.py:125 models.py:139
#: models.py:156 models.py:215
msgid "Name"
msgstr "Name"
#: models.py:10
#: models.py:13
msgid "Name or iteration of the event"
msgstr "Name oder Iteration des Events"
#: models.py:11
#: models.py:14
#, fuzzy
#| msgid "Short Name"
msgid "Short Form"
msgstr "Kurzer Name"
#: models.py:12
#: models.py:15
msgid "Short name of letters/numbers/dots/dashes/underscores used in URLs."
msgstr ""
#: models.py:13
#: models.py:16
msgid "Start"
msgstr "Start"
#: models.py:13
#: models.py:16
msgid "Time the event begins"
msgstr "Zeit zu der das Event beginnt"
#: models.py:14
#: models.py:17
msgid "End"
msgstr "Ende"
#: models.py:14
#: models.py:17
msgid "Time the event ends"
msgstr "Zeit zu der das Event endet"
#: models.py:15
#: models.py:18
msgid "Place"
msgstr "Ort"
#: models.py:16
#: models.py:19
msgid "City etc. the event takes place in"
msgstr "Stadt o.ä. in der das Event stattfindet"
#: models.py:17
#: models.py:20
msgid "Active State"
msgstr "Aktiver Status"
#: models.py:17
#: models.py:20
msgid "Marks currently active events"
msgstr "Markiert aktuell aktive Events"
#: models.py:21
#: models.py:22
msgid "Base URL"
msgstr "URL-Prefix"
#: models.py:22
msgid "Prefix for wiki link construction"
msgstr "Prefix für die automatische Generierung von Wiki-Links"
#: models.py:26
msgid "Events"
msgstr "Events"
#: models.py:35
#: models.py:40
msgid "Nickname"
msgstr "Spitzname"
#: models.py:35
#: models.py:40
msgid "Name to identify an AK owner by"
msgstr "Name durch den eine AK Leitung identifiziert wird"
#: models.py:36
#: models.py:41
msgid "Slug"
msgstr "Slug"
#: models.py:42
msgid "Slug for URL generation"
msgstr "Slug für URL-Generierung"
#: models.py:43
msgid "E-Mail Address"
msgstr "E-Mail Adresse"
#: models.py:36
#: models.py:43
msgid "Contact mail"
msgstr "Kontakt E-Mail"
#: models.py:37
#: models.py:44
msgid "Institution"
msgstr "Instutution"
#: models.py:37
#: models.py:44
msgid "Uni etc."
msgstr "Universität o.ä."
#: models.py:38 models.py:129
#: models.py:45 models.py:165
msgid "Web Link"
msgstr "Internet Link"
#: models.py:38
#: models.py:45
msgid "Link to Homepage"
msgstr "Link zu Homepage oder Webseite"
#: models.py:44
#: models.py:51
msgid "AK Owner"
msgstr "AK Leitung"
#: models.py:45
#: models.py:52
msgid "AK Owners"
msgstr "AK Leitungen"
#: models.py:58
#: models.py:94
msgid "Name of the AK Category"
msgstr "Name des AK Kategorie"
#: models.py:59 models.py:75
#: models.py:95 models.py:111
msgid "Color"
msgstr "Farbe"
#: models.py:59 models.py:75
#: models.py:95 models.py:111
msgid "Color for displaying"
msgstr "Farbe für die Anzeige"
#: models.py:60 models.py:123
#: models.py:96 models.py:159
msgid "Description"
msgstr "Beschreibung"
#: models.py:60
#: models.py:96
msgid "Short description of this AK Category"
msgstr "Beschreibung der AK-Kategorie"
#: models.py:64
#: models.py:100
msgid "AK Categories"
msgstr "AK Kategorien"
#: models.py:74
#: models.py:110
msgid "Name of the AK Track"
msgstr "Name des AK Tracks"
#: models.py:78
#: models.py:114
msgid "AK Track"
msgstr "AK Track"
#: models.py:79
#: models.py:115
msgid "AK Tracks"
msgstr "AK Tracks"
#: models.py:89
#: models.py:125
msgid "Name of the AK Tag"
msgstr "Name das AK Tags"
#: models.py:92
#: models.py:128
msgid "AK Tag"
msgstr "AK Tag"
#: models.py:93
#: models.py:129
msgid "AK Tags"
msgstr "AK Tags"
#: models.py:103
#: models.py:139
msgid "Name of the Requirement"
msgstr "Name der Anforderung"
#: models.py:109
#: models.py:145
msgid "AK Requirement"
msgstr "AK Anforderung"
#: models.py:110
#: models.py:146
msgid "AK Requirements"
msgstr "AK Anforderungen"
#: models.py:120
#: models.py:156
msgid "Name of the AK"
msgstr "Name des AKs"
#: models.py:121
#: models.py:157
msgid "Short Name"
msgstr "Kurzer Name"
#: models.py:122
#: models.py:158
msgid "Name displayed in the schedule"
msgstr "Name zur Anzeige im AK Plan"
#: models.py:123
#: models.py:159
msgid "Description of the AK"
msgstr "Beschreibung des AKs"
#: models.py:125
#: models.py:161
msgid "Owners"
msgstr "Leitungen"
#: models.py:126
#: models.py:162
msgid "Those organizing the AK"
msgstr "Menschen, die den AK organisieren und halten"
#: models.py:129
#: models.py:165
msgid "Link to wiki page"
msgstr "Link zur Wiki Seite"
#: models.py:131
#: models.py:167
msgid "Category"
msgstr "Kategorie"
#: models.py:132
#: models.py:168
msgid "Category of the AK"
msgstr "Kategorie des AKs"
#: models.py:133
#: models.py:169
msgid "Tags"
msgstr "Tags"
#: models.py:133
#: models.py:169
msgid "Tags provided by owners"
msgstr "Tags, die durch die AK Leitung vergeben wurden"
#: models.py:134
#: models.py:170
msgid "Track"
msgstr "Track"
#: models.py:135
#: models.py:171
msgid "Track the AK belongs to"
msgstr "Track zu dem der AK gehört"
#: models.py:137
#: models.py:173
msgid "Resolution Intention"
msgstr "Resolutionsabsicht"
#: models.py:138
#: models.py:174
msgid "Intends to submit a resolution"
msgstr "Beabsichtigt eine Resolution einzureichen"
#: models.py:139
#: models.py:175
msgid "Present this AK"
msgstr "AK Präsentieren"
#: models.py:139
#: models.py:176
msgid "Present results of this AK"
msgstr "Die Ergebnisse dieses AKs vorstellen"
#: models.py:141
#: models.py:178
msgid "Requirements"
msgstr "Anforderungen"
#: models.py:142
#: models.py:179
msgid "AK's Requirements"
msgstr "Anforderungen des AKs"
#: models.py:144
#: models.py:181
msgid "Conflicting AKs"
msgstr "AK Konflikte"
#: models.py:145
#: models.py:182
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:146
#: models.py:183
msgid "Prerequisite AKs"
msgstr "Vorausgesetzte AKs"
#: models.py:147
#: models.py:184
msgid "AKs that should precede this AK in the schedule"
msgstr "AKS die im AK Plan vor diesem AK stattfinden müssen"
#: models.py:149
#: models.py:186
msgid "Internal Notes"
msgstr "Interne Notizen"
#: models.py:149
#: models.py:186
msgid "Notes to organizers"
msgstr "Notizen an die Organisator*innen"
#: models.py:151
#: models.py:188
msgid "Interest"
msgstr "Interesse"
#: models.py:151
#: models.py:188
msgid "Expected number of people"
msgstr "Erwartete Personenzahl"
#: models.py:158
#: models.py:195
msgid "AKs"
msgstr "AKs"
#: models.py:177
#: models.py:215
msgid "Name or number of the room"
msgstr "Name oder Nummer des Raums"
#: models.py:178
#: models.py:216
msgid "Building"
msgstr "Gebäude"
#: models.py:179
#: models.py:217
msgid "Name or number of the building"
msgstr "Name oder Nummer des Gebäudes"
#: models.py:180
#: models.py:218
msgid "Capacity"
msgstr "Kapazität"
#: models.py:180
#: models.py:218
msgid "Maximum number of people"
msgstr "Maximale Personenzahl"
#: models.py:181
#: models.py:219
msgid "Properties"
msgstr "Eigenschaften"
#: models.py:182
#: models.py:220
msgid "AK requirements fulfilled by the room"
msgstr "AK Anforderungen, die dieser Raum erfüllt"
#: models.py:189
#: models.py:227
msgid "Rooms"
msgstr "Räume"
#: models.py:202
#: models.py:240
msgid "AK being mapped"
msgstr "AK, der zugeordnet wird"
#: models.py:204
#: models.py:242
msgid "Room the AK will take place in"
msgstr "Raum in dem der AK stattfindet"
#: models.py:205
#: models.py:243
msgid "Slot Begin"
msgstr "Beginn des Slots"
#: models.py:205
#: models.py:243
msgid "Time and date the slot begins"
msgstr "Zeit und Datum zu der der AK beginnt"
#: models.py:206
#: models.py:245
msgid "Duration"
msgstr "Dauer"
#: models.py:207
#: models.py:246
msgid "Length in hours"
msgstr "Länge in Stunden"
#: models.py:213
#: models.py:252
msgid "AK Slot"
msgstr "AK Slot"
#: models.py:214
#: models.py:253
msgid "AK Slots"
msgstr "AK Slot"
#: models.py:267
msgid "Not scheduled yet"
msgstr "Noch nicht geplant"
# Generated by Django 2.2.6 on 2019-10-18 23:15
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0015_ak_present_field'),
]
operations = [
migrations.AlterField(
model_name='akslot',
name='room',
field=models.ForeignKey(blank=True, help_text='Room the AK will take place in', null=True,
on_delete=django.db.models.deletion.SET_NULL, to='AKModel.Room',
verbose_name='Room'),
),
]
# Generated by Django 2.2.6 on 2019-10-19 17:47
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):
dependencies = [
('AKModel', '0016_slot_room_blank'),
]
operations = [
migrations.AddField(
model_name='akowner',
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')
)
]
# 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 = [
]
# Generated by Django 2.2.6 on 2019-10-24 15:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0018_merge_20191023_2227'),
]
operations = [
migrations.AlterField(
model_name='akslot',
name='start',
field=models.DateTimeField(blank=True, help_text='Time and date the slot begins', null=True, verbose_name='Slot Begin'),
),
]
# Generated by Django 2.2.6 on 2019-10-24 19:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0019_slot_start_optional'),
]
operations = [
migrations.AlterField(
model_name='ak',
name='name',
field=models.CharField(help_text='Name of the AK', max_length=256, verbose_name='Name'),
),
migrations.AlterField(
model_name='ak',
name='short_name',
field=models.CharField(blank=True, help_text='Name displayed in the schedule', max_length=64, verbose_name='Short Name'),
),
migrations.AlterUniqueTogether(
name='ak',
unique_together={('short_name', 'event'), ('name', 'event')},
),
]
# Generated by Django 2.2.6 on 2019-10-24 22:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0020_ak_unique'),
]
operations = [
migrations.AddField(
model_name='event',
name='base_url',
field=models.URLField(blank=True, help_text='Prefix for wiki link construction', verbose_name='Base URL'),
),
]
# Create your models here.
import itertools
from django.db import models
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
......@@ -16,6 +19,8 @@ class Event(models.Model):
help_text=_('City etc. the event takes place in'))
active = models.BooleanField(verbose_name=_('Active State'), help_text=_('Marks currently active events'))
base_url = models.URLField(verbose_name=_("Base URL"), help_text=_("Prefix for wiki link construction"), blank=True)
class Meta:
verbose_name = _('Event')
verbose_name_plural = _('Events')
......@@ -32,7 +37,9 @@ class Event(models.Model):
class AKOwner(models.Model):
""" An AKOwner describes the person organizing/holding an AK.
"""
name = models.CharField(max_length=256, verbose_name=_('Nickname'), help_text=_('Name to identify an AK owner by'))
name = models.CharField(max_length=64, verbose_name=_('Nickname'), help_text=_('Name to identify an AK owner by'))
slug = models.SlugField(max_length=64, blank=True, unique=True, verbose_name=_('Slug'),
help_text=_('Slug for URL generation'))
email = models.EmailField(max_length=128, blank=True, verbose_name=_('E-Mail Address'), help_text=_('Contact mail'))
institution = models.CharField(max_length=128, blank=True, verbose_name=_('Institution'), help_text=_('Uni etc.'))
link = models.URLField(blank=True, verbose_name=_('Web Link'), help_text=_('Link to Homepage'))
......@@ -51,6 +58,35 @@ class AKOwner(models.Model):
return f"{self.name} ({self.institution})"
return self.name
def _generate_slug(self):
max_length = self._meta.get_field('slug').max_length
slug_candidate = slugify(self.name)[:max_length]
if not AKOwner.objects.filter(slug=slug_candidate).exists():
self.slug = slug_candidate
return
slug_candidate = slugify(slug_candidate + '_' + self.institution)[:max_length]
if not AKOwner.objects.filter(slug=slug_candidate).exists():
self.slug = slug_candidate
return
for i in itertools.count(1):
if not AKOwner.objects.filter(slug=slug_candidate).exists():
break
digits = len(str(i))
slug_candidate = '{}-{}'.format(slug_candidate[:-digits + 1], i)
self.slug = slug_candidate
def save(self, *args, **kwargs):
if not self.slug:
self._generate_slug()
super().save(*args, **kwargs)
@staticmethod
def get_by_slug(slug):
return AKOwner.objects.get(slug=slug)
class AKCategory(models.Model):
""" An AKCategory describes the characteristics of an AK, e.g. content vs. recreational.
......@@ -117,8 +153,8 @@ class AKRequirement(models.Model):
class AK(models.Model):
""" An AK is a slot-based activity to be scheduled during an event.
"""
name = models.CharField(max_length=256, unique=True, verbose_name=_('Name'), help_text=_('Name of the AK'))
short_name = models.CharField(max_length=64, unique=True, blank=True, verbose_name=_('Short Name'),
name = models.CharField(max_length=256, verbose_name=_('Name'), help_text=_('Name of the AK'))
short_name = models.CharField(max_length=64, blank=True, verbose_name=_('Short Name'),
help_text=_('Name displayed in the schedule'))
description = models.TextField(blank=True, verbose_name=_('Description'), help_text=_('Description of the AK'))
......@@ -136,7 +172,8 @@ class AK(models.Model):
reso = models.BooleanField(verbose_name=_('Resolution Intention'), default=False,
help_text=_('Intends to submit a resolution'))
present = models.BooleanField(verbose_name=_("Present this AK"), null=True, help_text=_("Present results of this AK"))
present = models.BooleanField(verbose_name=_("Present this AK"), null=True,
help_text=_("Present results of this AK"))
requirements = models.ManyToManyField(to=AKRequirement, blank=True, verbose_name=_('Requirements'),
help_text=_("AK's Requirements"))
......@@ -156,6 +193,7 @@ class AK(models.Model):
class Meta:
verbose_name = _('AK')
verbose_name_plural = _('AKs')
unique_together = [('name', 'event'), ('short_name', 'event')]
def __str__(self):
if self.short_name:
......@@ -200,9 +238,10 @@ class AKSlot(models.Model):
""" An AK Mapping matches an AK to a room during a certain time.
"""
ak = models.ForeignKey(to=AK, on_delete=models.CASCADE, verbose_name=_('AK'), help_text=_('AK being mapped'))
room = models.ForeignKey(to=Room, null=True, on_delete=models.SET_NULL, verbose_name=_('Room'),
room = models.ForeignKey(to=Room, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('Room'),
help_text=_('Room the AK will take place in'))
start = models.DateTimeField(verbose_name=_('Slot Begin'), help_text=_('Time and date the slot begins'))
start = models.DateTimeField(verbose_name=_('Slot Begin'), help_text=_('Time and date the slot begins'),
blank=True, null=True)
duration = models.DecimalField(max_digits=4, decimal_places=2, default=2, verbose_name=_('Duration'),
help_text=_('Length in hours'))
......@@ -224,4 +263,6 @@ class AKSlot(models.Model):
"""
Display start time of slot in format weekday + time, e.g. "Fri 14:00"
"""
if self.start is None:
return _("Not scheduled yet")
return self.start.strftime('%a %H:%M')
from django.http import Http404
from django.shortcuts import get_object_or_404
from AKModel.models import Event
class FilterByEventSlugMixin:
class EventSlugMixin:
"""
Mixin to filter different querysets based on a event slug from the request url
Mixin to handle views with event slugs
"""
event = None
def get_queryset(self):
def _load_event(self):
# Find event based on event slug
try:
self.event = Event.get_by_slug(self.kwargs.get("event_slug", None))
except Event.DoesNotExist:
raise Http404
self.event = get_object_or_404(Event, slug=self.kwargs.get("event_slug", None))
# Filter current queryset based on url event slug or return 404 if event slug is invalid
return super().get_queryset().filter(event=self.event)
def get(self, request, *args, **kwargs):
self._load_event()
return super().get(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
self._load_event()
return super().post(request, *args, **kwargs)
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(object_list=object_list, **kwargs)
# Add event to context (to make it accessible in templates)
context["event"] = self.event
return context
class FilterByEventSlugMixin(EventSlugMixin):
"""
Mixin to filter different querysets based on a event slug from the request url
"""
def get_queryset(self):
# Filter current queryset based on url event slug or return 404 if event slug is invalid
return super().get_queryset().filter(event=self.event)
from django import forms
from django.core.exceptions import ValidationError
from AKModel.models import AK, AKOwner
from django.utils.translation import ugettext_lazy as _
class AKForm(forms.ModelForm):
class Meta:
model = AK
fields = ['name',
'short_name',
'link',
'owners',
'description',
'category',
'reso',
'present',
'requirements',
'conflicts',
'prerequisites',
'notes',
'event'
]
widgets = {
'requirements': forms.CheckboxSelectMultiple,
'event': forms.HiddenInput,
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Use better multiple select input for owners, conflicts and prerequisites
self.fields["owners"].widget.attrs = {'class': 'chosen-select'}
self.fields["conflicts"].widget.attrs = {'class': 'chosen-select'}
self.fields["prerequisites"].widget.attrs = {'class': 'chosen-select'}
help_tags_addition = _('Separate multiple tags with semicolon')
# Add text fields for tags
self.fields["tags_raw"] = forms.CharField(
required=False,
label=AK.tags.field.verbose_name,
help_text=f"{AK.tags.field.help_text} ({help_tags_addition})")
@staticmethod
def _clean_duration(duration):
# Handle different duration formats (h:mm and decimal comma instead of point)
if ":" in duration:
h, m = duration.split(":")
duration = int(h) + int(m) / 60
if "," in str(duration):
duration = float(duration.replace(",", "."))
try:
float(duration)
except ValueError:
raise ValidationError(
_('"%(duration)s" is not a valid duration'),
code='invalid',
params={'duration': duration},
)
return duration
def clean(self):
cleaned_data = super().clean()
# Generate short name if not given
short_name = self.cleaned_data["short_name"]
if len(short_name) == 0:
cleaned_data["short_name"] = ''.join(x for x in self.cleaned_data["name"].title() if x.isalnum())
# Get tag names from raw tags
cleaned_data["tag_names"] = [name.strip().lower() for name in cleaned_data["tags_raw"].split(";")]
# Get durations from raw durations field
if "durations" in cleaned_data:
cleaned_data["durations"] = [self._clean_duration(d) for d in self.cleaned_data["durations"].split()]
return cleaned_data
class AKSubmissionForm(AKForm):
class Meta(AKForm.Meta):
exclude = ['link']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Add field for durations
self.fields["durations"] = forms.CharField(
widget=forms.Textarea,
label=_("Duration(s)"),
help_text=_("Enter at least one planned duration (in hours). If your AK should have multiple slots, use multiple lines")
)
class AKEditForm(AKForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Add existing tags to tag raw field
self.fields["tags_raw"].initial = "; ".join(str(tag) for tag in self.instance.tags.all())
class AKWishForm(AKSubmissionForm):
class Meta(AKForm.Meta):
exclude = ['owners']
class AKOwnerForm(forms.ModelForm):
class Meta:
model = AKOwner
fields = ['name', 'email', 'institution', 'link']
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-21 22:38+0000\n"
"POT-Creation-Date: 2019-10-24 23:21+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,58 +17,91 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: forms.py:39
msgid "Separate multiple tags with semicolon"
msgstr "Mehrere Tags mit Semikolon trennen"
#: forms.py:60
#, python-format
msgid "\"%(duration)s\" is not a valid duration"
msgstr "\"%(duration)s\" ist keine gültige Dauer"
#: forms.py:94
msgid "Duration(s)"
msgstr "Dauer(n)"
#: forms.py:95
msgid ""
"Enter at least one planned duration (in hours). If your AK should have "
"multiple slots, use multiple lines"
msgstr ""
"Mindestens eine geplante Dauer (in Stunden) angeben. Wenn der AK mehrere "
"Slots haben soll, mehrere Zeilen verwenden"
#: templates/AKSubmission/ak_detail.html:8
#: templates/AKSubmission/ak_detail.html:13
#: templates/AKSubmission/ak_detail.html:18
#: templates/AKSubmission/ak_list.html:8 templates/AKSubmission/ak_list.html:13
#: templates/AKSubmission/ak_edit.html:14 templates/AKSubmission/ak_list.html:8
#: templates/AKSubmission/ak_list.html:13
#: templates/AKSubmission/ak_list.html:18
#: templates/AKSubmission/akowner_create_update.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:19
#: templates/AKSubmission/submit_new_wish.html:10
msgid "AK Submission"
msgstr "AK-Eintragung"
#: templates/AKSubmission/ak_detail.html:27
#: templates/AKSubmission/ak_detail.html:29
#: templates/AKSubmission/ak_list_table.html:30
msgid "AK Wish"
msgstr "AK-Wunsch"
#: templates/AKSubmission/ak_detail.html:30
#: templates/AKSubmission/ak_detail.html:32
#: templates/AKSubmission/ak_list_table.html:10
msgid "Who?"
msgstr "Wer?"
#: templates/AKSubmission/ak_detail.html:32
#: templates/AKSubmission/ak_detail.html:34
#: templates/AKSubmission/ak_list_table.html:11
msgid "Category"
msgstr "Kategorie"
#: templates/AKSubmission/ak_detail.html:38
#: templates/AKSubmission/ak_detail.html:40
msgid "Present this AK"
msgstr "Diesen AK vorstellen"
#: templates/AKSubmission/ak_detail.html:42
#: templates/AKSubmission/ak_detail.html:44
#: templates/AKSubmission/ak_list.html:26
#: templates/AKSubmission/ak_list_table.html:12
msgid "Tags"
msgstr "Tags"
#: templates/AKSubmission/ak_detail.html:48
#: templates/AKSubmission/ak_detail.html:50
msgid "Reso?"
msgstr "Reso?"
#: templates/AKSubmission/ak_detail.html:60
#: templates/AKSubmission/ak_detail.html:62
msgid "When?"
msgstr "Wann?"
#: templates/AKSubmission/ak_detail.html:61
#: templates/AKSubmission/ak_detail.html:63
msgid "Duration"
msgstr "Dauer"
#: templates/AKSubmission/ak_detail.html:62
#: templates/AKSubmission/ak_detail.html:64
msgid "Room"
msgstr "Raum"
#: templates/AKSubmission/ak_edit.html:8 templates/AKSubmission/ak_edit.html:21
msgid "Edit AK"
msgstr "AK bearbeiten"
#: templates/AKSubmission/ak_edit.html:16
msgid "Edit"
msgstr "Bearbeiten"
#: templates/AKSubmission/ak_list.html:14
msgid "AKs"
msgstr "AKs"
......@@ -89,35 +122,85 @@ msgstr "Diesen AK vorstellen"
msgid "Reso"
msgstr "Reso"
#: templates/AKSubmission/submission_overview.html:17
#: templates/AKSubmission/akowner_create_update.html:7
#: templates/AKSubmission/akowner_create_update.html:19
msgid "AK Owner"
msgstr "AK-Leitung"
#: templates/AKSubmission/akowner_create_update.html:25
#: templates/AKSubmission/submit_new.html:34
msgid "Reset"
msgstr "Zurücksetzen"
#: templates/AKSubmission/akowner_create_update.html:29
#: templates/AKSubmission/submit_new.html:38
msgid "Cancel"
msgstr "Abbrechen"
#: templates/AKSubmission/akowner_create_update.html:32
#: templates/AKSubmission/submit_new.html:41
msgid "Submit"
msgstr "Eintragen"
#: templates/AKSubmission/submission_overview.html:19
msgid ""
"On this page you can see a list of current AKs, change them and add new ones."
msgstr ""
"Auf dieser Seite kannst du eine Liste von aktuellen AKs sehen, diese "
"bearbeiten und neue hinzufügen."
#: templates/AKSubmission/submission_overview.html:20
msgid "Submit"
msgstr "Eintragen"
#: templates/AKSubmission/submission_overview.html:25
#: templates/AKSubmission/submit_new_wish.html:5
#: templates/AKSubmission/submit_new_wish.html:11
#: templates/AKSubmission/submit_new_wish.html:15
msgid "New AK Wish"
msgstr "Neuer AK-Wunsch"
#: templates/AKSubmission/submission_overview.html:29
msgid "Who"
msgstr "Wer"
#: templates/AKSubmission/submission_overview.html:21
#: templates/AKSubmission/submission_overview.html:32
msgid "I do not own AKs yet"
msgstr "Ich leite bisher keine AKs"
#: templates/AKSubmission/submission_overview.html:40
#: templates/AKSubmission/submit_new.html:8
#: templates/AKSubmission/submit_new.html:21
#: templates/AKSubmission/submit_new.html:28
msgid "New AK"
msgstr "Neuer AK"
#: templates/AKSubmission/submission_overview.html:22
msgid "New AK Wish"
msgstr "Neuer AK-Wunsch"
#: templates/AKSubmission/submission_overview.html:46
msgid "Edit Person Info"
msgstr "Personen-Info bearbeiten"
#: templates/AKSubmission/submission_overview.html:26
#: templates/AKSubmission/submission_overview.html:53
msgid "Current AKs"
msgstr "Aktuelle AKs"
#: views.py:33
#: views.py:44
msgid "Wishes"
msgstr "Wünsche"
#: views.py:33
#: views.py:44
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:105
msgid "AK successfully created"
msgstr "AK erfolgreich angelegt"
#: views.py:152
msgid "AK successfully updated"
msgstr "AK erfolgreich bearbeitet"
#: views.py:209
msgid "Person Info successfully updated"
msgstr "Personen-Info erfolgreich bearbeitet"
#: views.py:221
msgid "No user selected"
msgstr "Keine Person ausgewählt"
......@@ -17,11 +17,13 @@
{% block content %}
<h1 style="margin-bottom: 30px;">{{ ak.event.name }}: {% trans "AK Submission" %}</h1>
{% include "AKSubmission/messages.html" %}
<div class="float-right">
{% if ak.link != "" %}
<a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a>
{% endif %}
<a href="#" class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a>
<a href="{% url 'submit:ak_edit' event_slug=ak.event.slug pk=ak.pk %}" class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a>
</div>
<h2>{% if ak.wish %}{% trans "AK Wish" %}: {% endif %}{{ ak.name }}</h2>
......
{% extends 'AKSubmission/submit_new.html' %}
{% load i18n %}
{% load bootstrap4 %}
{% load fontawesome %}
{% load staticfiles %}
{% block title %}{{ event.slug }} - {% trans "Edit AK" %}{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="#">AKPlanning</a></li>
<li class="breadcrumb-item"><a href="#">{{ event.slug }}</a></li>
<li class="breadcrumb-item"><a
href="{% url 'submit:submission_overview' event_slug=event.slug %}">{% trans "AK Submission" %}</a></li>
<li class="breadcrumb-item"><a href="#">{{ ak.short_name }}</a></li>
<li class="breadcrumb-item active">{% trans "Edit" %}</li>
{% endblock %}
{% block headline %}
<h2>{% trans 'Edit AK' %}</h2>
{% endblock %}
......@@ -39,7 +39,7 @@
{% if ak.link %}
<a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a>
{% endif %}
<a href="#" class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a>
<a href="{% url 'submit:ak_edit' event_slug=event.slug pk=ak.pk %}" class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a>
</td>
</tr>
<tr>
......
{% extends 'base.html' %}
{% load i18n %}
{% load bootstrap4 %}
{% load fontawesome %}
{% block title %}{{ event.slug }} - {% trans "AK Owner" %}{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="#">AKPlanning</a></li>
<li class="breadcrumb-item"><a href="#">{{ event.slug }}</a></li>
<li class="breadcrumb-item"><a
href="{% url 'submit:submission_overview' event_slug=event.slug %}">{% trans "AK Submission" %}</a></li>
<li class="breadcrumb-item active">{{ owner.slug }}</li>
{% endblock %}
{% block content %}
{% block headline %}
<h2>{% trans 'AK Owner' %}</h2>
{% endblock %}
<form method="POST" class="post-form">{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button type="reset" class="btn btn-danger">
{% fontawesome_icon "undo-alt" %} {% trans "Reset" %}
</button>
<a href="{% url 'submit:submission_overview' event_slug=event.slug %}" class="btn btn-secondary">
{% fontawesome_icon "times" %} {% trans "Cancel" %}
</a>
<button type="submit" class="save btn btn-primary float-right">
{% fontawesome_icon "check" %} {% trans "Submit" %}
</button>
{% endbuttons %}
</form>
{% endblock %}
\ No newline at end of file
{% load tags_AKSubmission %}
{% if messages %}
{% for message in messages %}
<div class="alert alert-dismissible {{ message.tags | message_bootstrap_class }}">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ message }}
</div>
{% endfor %}
{% endif %}
......@@ -14,12 +14,39 @@
{% block content %}
<h1>{{ event.name }}: {% trans "AK Submission" %}</h1>
{% include "AKSubmission/messages.html" %}
{% blocktrans %}On this page you can see a list of current AKs, change them and add new ones.{% endblocktrans %}
<div class="jumbotron" style="margin-top:20px;">
<h2>{% trans "Submit" %}</h2>
<a href="#" class="btn btn-primary">{% trans "New AK" %}</a>
<a href="#" class="btn btn-info">{% trans "New AK Wish" %}</a>
<form method="POST" action="#" class="form-row">
{% csrf_token %}
<a href="{% url 'submit:submit_ak_wish' event_slug=event.slug %}" class="btn btn-info">
{% trans "New AK Wish" %}
</a>
<span style="font-size: 1.5em">
&nbsp;&nbsp; | &nbsp;
<label for="selectOwnerId" class="align-middle d-inline">{% trans "Who" %}:</label>
</span>&nbsp;&nbsp;
<select name="owner_id" id="selectOwnerId" class="">
<option value="-1">{% trans "I do not own AKs yet" %}</option>
{% for owner in existingOwners %}
<option value="{{ owner.pk }}">{{ owner }}</option>
{% endfor %}
</select> &nbsp;&nbsp;
<input
type="submit"
class="btn btn-primary"
value="{% trans "New AK" %}"
formaction="{% url 'submit:akowner_select' event_slug=event.slug %}"
/>&nbsp;&nbsp;
<input
type="submit"
class="btn btn-success"
value="{% trans 'Edit Person Info' %}"
formaction="{% url 'submit:akowner_edit_dispatch' event_slug=event.slug %}"
/>
</form>
</div>
......
{% extends 'base.html' %}
{% load i18n %}
{% load bootstrap4 %}
{% load fontawesome %}
{% load staticfiles %}
{% block title %}{{ event.slug }} - {% trans "New AK" %}{% endblock %}
{% block imports %}
<link rel="stylesheet" href="{% static 'common/vendor/chosen-js/chosen.css' %}">
<link rel="stylesheet" href="{% static 'common/css/bootstrap-choosen.css' %}">
{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="#">AKPlanning</a></li>
<li class="breadcrumb-item"><a href="#">{{ event.slug }}</a></li>
<li class="breadcrumb-item"><a
href="{% url 'submit:submission_overview' event_slug=event.slug %}">{% trans "AK Submission" %}</a></li>
<li class="breadcrumb-item"><a href="#">{{ owner.slug }}</a></li>
<li class="breadcrumb-item active">{% trans "New AK" %}</li>
{% endblock %}
{% block content %}
{% include "AKSubmission/messages.html" %}
{% block headline %}
<h2>{% trans 'New AK' %}</h2>
{% endblock %}
<form method="POST" class="post-form">{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button type="reset" class="btn btn-danger">
{% fontawesome_icon "undo-alt" %} {% trans "Reset" %}
</button>
<a href="{% url 'submit:submission_overview' event_slug=event.slug %}" class="btn btn-secondary">
{% fontawesome_icon "times" %} {% trans "Cancel" %}
</a>
<button type="submit" class="save btn btn-primary float-right">
{% fontawesome_icon "check" %} {% trans "Submit" %}
</button>
{% endbuttons %}
</form>
{% endblock %}
{% block bottom_script %}
<script src="{% static 'common/vendor/chosen-js/chosen.jquery.js' %}"></script>
<script>
$(function() {
$('.chosen-select').chosen();
});
</script>
{% endblock %}
\ No newline at end of file
{% extends 'AKSubmission/submit_new.html' %}
{% load i18n %}
{% block title %}{{ event.slug }} - {% trans "New AK Wish" %}{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="#">AKPlanning</a></li>
<li class="breadcrumb-item"><a href="#">{{ event.slug }}</a></li>
<li class="breadcrumb-item"><a href="#">{% trans "AK Submission" %}</a></li>
<li class="breadcrumb-item active">{% trans "New AK Wish" %}</li>
{% endblock %}
{% block headline %}
<h2>{% trans 'New AK Wish' %}</h2>
{% endblock %}
\ No newline at end of file
......@@ -24,3 +24,15 @@ def category_list(categories, event_slug):
@register.inclusion_tag("AKSubmission/category_linked_badge.html")
def category_linked_badge(category, event_slug):
return {"category": category, "event_slug": event_slug}
@register.filter
def message_bootstrap_class(tag):
print(tag)
if tag == "error":
return "alert-danger"
elif tag == "success":
return "alert-success"
elif tag == "warning":
return "alert-warning"
return "alert-info"
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