Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • koma/feature/preference-polling-form
  • komasolver
  • main
  • renovate/django_csp-4.x
4 results

Target

Select target project
  • konstantin/akplanning
  • matedealer/akplanning
  • kif/akplanning
  • mirco/akplanning
  • lordofthevoid/akplanning
  • voidptr/akplanning
  • xayomer/akplanning-fork
  • mollux/akplanning
  • neumantm/akplanning
  • mmarx/akplanning
  • nerf/akplanning
  • felix_bonn/akplanning
  • sebastian.uschmann/akplanning
13 results
Select Git revision
  • ak-import
  • feature/clear-schedule-button
  • feature/export-filtering
  • feature/json-export-via-rest-framework
  • feature/json-schedule-import-tests
  • feature/preference-polling-form
  • fix/add-room-import-only-once
  • main
  • renovate/django-5.x
  • renovate/django-debug-toolbar-4.x
  • renovate/django-simple-history-3.x
  • renovate/mysqlclient-2.x
12 results
Show changes
Showing
with 2149 additions and 383 deletions
"""
Central and admin forms
"""
import csv
import io
from bootstrap_datepicker_plus.widgets import DateTimePickerInput
from django import forms
from django.forms.utils import ErrorList
from django.utils.translation import gettext_lazy as _
from AKModel.availability.forms import AvailabilitiesFormMixin
from AKModel.models import Event, AKCategory, AKRequirement, Room
from AKModel.models import Event, AKCategory, AKRequirement, Room, AKType
class DateTimeInput(forms.DateInput):
"""
Simple widget for datetime input fields using the HTML5 datetime-local input type
"""
input_type = 'datetime-local'
class NewEventWizardStartForm(forms.ModelForm):
"""
Initial view of new event wizard
This form is a model form for Event, but only with a subset of the required fields.
It is therefore not possible to really create an event using this form, but only to enter
information, in particular the timezone, that is needed to correctly handle/parse the user
inputs for further required fields like start and end of the event.
The form will be used for this partial input, the input of the remaining required fields
will then be handled by :class:`NewEventWizardSettingsForm` (see below).
"""
class Meta:
model = Event
fields = ['name', 'slug', 'timezone', 'plan_hidden']
fields = ['name', 'slug', 'timezone', 'plan_hidden', 'poll_hidden']
widgets = {
'plan_hidden': forms.HiddenInput(),
'poll_hidden': forms.HiddenInput(),
}
# Special hidden field for wizard state handling
is_init = forms.BooleanField(initial=True, widget=forms.HiddenInput)
class NewEventWizardSettingsForm(forms.ModelForm):
"""
Form for second view of the event creation wizard.
Will handle the input of the remaining required as well as some optional fields.
See also :class:`NewEventWizardStartForm`.
"""
class Meta:
model = Event
exclude = []
fields = "__all__"
exclude = ['plan_published_at', 'poll_published_at']
widgets = {
'name': forms.HiddenInput(),
'slug': forms.HiddenInput(),
'timezone': forms.HiddenInput(),
'active': forms.HiddenInput(),
'start': DateTimePickerInput(options={"format": "YYYY-MM-DD HH:mm"}),
'end': DateTimePickerInput(options={"format": "YYYY-MM-DD HH:mm"}),
'reso_deadline': DateTimePickerInput(options={"format": "YYYY-MM-DD HH:mm"}),
'start': DateTimeInput(),
'end': DateTimeInput(),
'interest_start': DateTimeInput(),
'interest_end': DateTimeInput(),
'reso_deadline': DateTimeInput(),
'plan_hidden': forms.HiddenInput(),
'poll_hidden': forms.HiddenInput(),
}
class NewEventWizardPrepareImportForm(forms.Form):
"""
Wizard form for choosing an event to import/copy elements (requirements, categories, etc) from.
Is used to restrict the list of elements to choose from in the next step (see :class:`NewEventWizardImportForm`).
"""
import_event = forms.ModelChoiceField(
queryset=Event.objects.all(),
label=_("Copy ak requirements and ak categories of existing event"),
......@@ -46,6 +83,12 @@ class NewEventWizardPrepareImportForm(forms.Form):
class NewEventWizardImportForm(forms.Form):
"""
Wizard form for excaclty choosing which elemments to copy/import for the newly created event.
Possible elements are categories, requirements, and dashboard buttons if AKDashboard is active.
The lists are restricted to elements from the event selected in the previous step
(see :class:`NewEventWizardPrepareImportForm`).
"""
import_categories = forms.ModelMultipleChoiceField(
queryset=AKCategory.objects.all(),
widget=forms.CheckboxSelectMultiple,
......@@ -60,6 +103,14 @@ class NewEventWizardImportForm(forms.Form):
required=False,
)
import_types = forms.ModelMultipleChoiceField(
queryset=AKType.objects.all(),
widget=forms.CheckboxSelectMultiple,
label=_("Copy types"),
required=False,
)
# pylint: disable=too-many-arguments
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList,
label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None,
renderer=None):
......@@ -69,11 +120,15 @@ class NewEventWizardImportForm(forms.Form):
event=self.initial["import_event"])
self.fields["import_requirements"].queryset = self.fields["import_requirements"].queryset.filter(
event=self.initial["import_event"])
self.fields["import_types"].queryset = self.fields["import_types"].queryset.filter(
event=self.initial["import_event"])
# pylint: disable=import-outside-toplevel
# Local imports used to prevent cyclic imports and to only import when AKDashboard is available
from django.apps import apps
if apps.is_installed("AKDashboard"):
# If AKDashboard is active, allow to copy dashboard buttons, too
from AKDashboard.models import DashboardButton
self.fields["import_buttons"] = forms.ModelMultipleChoiceField(
queryset=DashboardButton.objects.filter(event=self.initial["import_event"]),
widget=forms.CheckboxSelectMultiple,
......@@ -83,26 +138,49 @@ class NewEventWizardImportForm(forms.Form):
class NewEventWizardActivateForm(forms.ModelForm):
"""
Wizard form to activate the newly created event
"""
class Meta:
fields = ["active"]
model = Event
class AdminIntermediateForm(forms.Form):
pass
"""
Base form for admin intermediate views (forms used there should inherit from this,
by default, the form is empty since it is only needed for the confirmation button)
"""
class AdminIntermediateActionForm(AdminIntermediateForm):
"""
Form for Admin Action Confirmation views -- has a pks field needed to handle the serialization/deserialization of
the IDs of the entities the user selected for the admin action to be performed on
"""
pks = forms.CharField(widget=forms.HiddenInput)
class SlideExportForm(AdminIntermediateForm):
"""
Form to control the slides generated from the AK list of an event
The user can select how many upcoming AKs are displayed at the footer to inform people that it is their turn soon,
whether the AK list should be restricted to those AKs that where marked for presentation, and whether ther should
be a symbol and empty space to take notes on for wishes
"""
num_next = forms.IntegerField(
min_value=0,
max_value=6,
initial=3,
label=_("# next AKs"),
help_text=_("How many next AKs should be shown on a slide?"))
types = forms.MultipleChoiceField(
label=_("AK Types"),
help_text=_("Which AK types should be included in the slides?"),
widget=forms.CheckboxSelectMultiple,
choices=[],
required=False)
presentation_mode = forms.TypedChoiceField(
initial=False,
label=_("Presentation only?"),
......@@ -121,6 +199,9 @@ class SlideExportForm(AdminIntermediateForm):
class DefaultSlotEditorForm(AdminIntermediateForm):
"""
Form for default slot editor
"""
availabilities = forms.CharField(
label=_('Default Slots'),
help_text=_(
......@@ -133,6 +214,12 @@ class DefaultSlotEditorForm(AdminIntermediateForm):
class RoomBatchCreationForm(AdminIntermediateForm):
"""
Form for room batch creation
Allows to input a list of room details and choose whether default availabilities should be generated for these
rooms. Will check that the input follows a CSV format with at least a name column present.
"""
rooms = forms.CharField(
label=_('New rooms'),
help_text=_('Enter room details in CSV format. Required colum is "name", optional colums are "location", '
......@@ -140,8 +227,20 @@ class RoomBatchCreationForm(AdminIntermediateForm):
widget=forms.Textarea,
required=True,
)
create_default_availabilities = forms.BooleanField(
label=_('Default availabilities?'),
help_text=_('Create default availabilities for all rooms?'),
required=False
)
def clean_rooms(self):
"""
Validate and transform the input for the rooms textfield
Treat the input as CSV and turn it into a dict containing the relevant information.
:return: a dict containing the raw room information
:rtype: dict[str, str]
"""
rooms_raw_text = self.cleaned_data["rooms"]
rooms_raw_dict = csv.DictReader(io.StringIO(rooms_raw_text), delimiter=";")
......@@ -152,6 +251,10 @@ class RoomBatchCreationForm(AdminIntermediateForm):
class RoomForm(forms.ModelForm):
"""
Room (creation) form (basic), will be extended for handling of availabilities
(see :class:`RoomFormWithAvailabilities`) and also for creating hybrid rooms in AKOnline (if active)
"""
class Meta:
model = Room
fields = ['name',
......@@ -162,6 +265,9 @@ class RoomForm(forms.ModelForm):
class RoomFormWithAvailabilities(AvailabilitiesFormMixin, RoomForm):
"""
Room (update) form including handling of availabilities, extends :class:`RoomForm`
"""
class Meta:
model = Room
fields = ['name',
......@@ -177,7 +283,7 @@ class RoomFormWithAvailabilities(AvailabilitiesFormMixin, RoomForm):
def __init__(self, *args, **kwargs):
# Init availability mixin
kwargs['initial'] = dict()
kwargs['initial'] = {}
super().__init__(*args, **kwargs)
self.initial = {**self.initial, **kwargs['initial']}
# Filter possible values for m2m when event is specified
......
......@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-26 19:54+0200\n"
"POT-Creation-Date: 2025-06-16 12:25+0200\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,9 +11,9 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: AKModel/admin.py:65 AKModel/admin.py:68
#: AKModel/templates/admin/AKModel/event_wizard/activate.html:32
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:48
#: AKModel/admin.py:92 AKModel/admin.py:102
#: AKModel/templates/admin/AKModel/event_wizard/activate.html:35
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:51
#: AKModel/templates/admin/AKModel/event_wizard/finish.html:21
#: AKModel/templates/admin/AKModel/requirements_overview.html:8
#: AKModel/templates/admin/AKModel/status/status.html:8
......@@ -21,67 +21,102 @@ msgstr ""
msgid "Status"
msgstr "Status"
#: AKModel/admin.py:70
#: AKModel/admin.py:104
msgid "Toggle plan visibility"
msgstr "Plansichtbarkeit ändern"
#: AKModel/admin.py:74 AKModel/admin.py:85 AKModel/views/manage.py:105
#: AKModel/admin.py:116 AKModel/admin.py:127 AKModel/views/manage.py:163
msgid "Publish plan"
msgstr "Plan veröffentlichen"
#: AKModel/admin.py:77 AKModel/admin.py:90 AKModel/views/manage.py:115
#: AKModel/admin.py:119 AKModel/admin.py:135 AKModel/views/manage.py:176
msgid "Unpublish plan"
msgstr "Plan verbergen"
#: AKModel/admin.py:153
#: AKModel/admin.py:122
msgid "Toggle poll visibility"
msgstr "Sichtbarkeit der Abfrage ändern"
#: AKModel/admin.py:134 AKModel/admin.py:162 AKModel/views/manage.py:166
msgid "Publish preference poll"
msgstr "Präferenzen-Abfrage veröffentlichen"
#: AKModel/admin.py:137 AKModel/admin.py:170 AKModel/views/manage.py:179
msgid "Unpublish preference poll"
msgstr "Präferenzen-Abfrage verbergen"
#: AKModel/admin.py:174 AKModel/models.py:775 AKModel/models.py:1226
#: AKModel/models.py:1262 AKModel/templates/admin/AKModel/aks_by_user.html:12
#: AKModel/templates/admin/AKModel/status/event_aks.html:10
#: AKModel/views/manage.py:97 AKModel/views/status.py:102
msgid "AKs"
msgstr "AKs"
#: AKModel/admin.py:240
msgid "Wish"
msgstr "AK-Wunsch"
#: AKModel/admin.py:159
#: AKModel/admin.py:246
msgid "Is wish"
msgstr "Ist ein Wunsch"
#: AKModel/admin.py:160
#: AKModel/admin.py:247
msgid "Is not a wish"
msgstr "Ist kein Wunsch"
#: AKModel/admin.py:204
#: AKModel/admin.py:308
msgid "Export to wiki syntax"
msgstr "In Wiki-Syntax exportieren"
#: AKModel/admin.py:213
#: AKModel/admin.py:325
msgid "Cannot export AKs from more than one event at the same time."
msgstr "Kann nicht AKs von mehreren Events zur selben Zeit exportieren."
#: AKModel/admin.py:228 AKModel/views/ak.py:80
#: AKModel/admin.py:340 AKModel/views/ak.py:99
msgid "Reset interest in AKs"
msgstr "Interesse an AKs zurücksetzen"
#: AKModel/admin.py:233 AKModel/views/ak.py:90
#: AKModel/admin.py:350 AKModel/views/ak.py:114
msgid "Reset AKs' interest counters"
msgstr "Interessenszähler der AKs zurücksetzen"
#: AKModel/admin.py:309 AKModel/admin.py:316
#: AKModel/admin.py:449 AKModel/admin.py:463
msgid "AK Details"
msgstr "AK-Details"
#: AKModel/admin.py:368 AKModel/views/manage.py:75
#: AKModel/admin.py:525 AKModel/views/manage.py:124
msgid "Mark Constraint Violations as manually resolved"
msgstr "Markiere Constraintverletzungen als manuell behoben"
#: AKModel/admin.py:373 AKModel/views/manage.py:85
#: AKModel/admin.py:534 AKModel/views/manage.py:137
msgid "Set Constraint Violations to level \"violation\""
msgstr "Constraintverletzungen auf Level \"Violation\" setzen"
#: AKModel/admin.py:378 AKModel/views/manage.py:95
#: AKModel/admin.py:543 AKModel/views/manage.py:150
msgid "Set Constraint Violations to level \"warning\""
msgstr "Constraintverletzungen auf Level \"Warning\" setzen"
#: AKModel/availability/forms.py:21 AKModel/availability/models.py:248
#: AKModel/admin.py:634
msgid "Activate selected users"
msgstr "Ausgewählte Benutzer*innen aktivieren"
#: AKModel/admin.py:643
msgid "The selected users have been activated."
msgstr "Benutzer*innen aktiviert"
#: AKModel/admin.py:645
msgid "Deactivate selected users"
msgstr "Ausgewählte Benutzer*innen deaktivieren"
#: AKModel/admin.py:654
msgid "The selected users have been deactivated."
msgstr "Benutzer*innen deaktiviert"
#: AKModel/availability/forms.py:25 AKModel/availability/models.py:338
msgid "Availability"
msgstr "Verfügbarkeit"
#: AKModel/availability/forms.py:23
#: AKModel/availability/forms.py:27
msgid ""
"Click and drag to mark the availability during the event, double-click to "
"delete. Or use the start and end inputs to add entries to the calendar view."
......@@ -90,121 +125,145 @@ msgstr ""
"Doppelt klicken um Einträge zu löschen. Oder Start- und End-Eingabe "
"verwenden, um der Kalenderansicht neue Einträge hinzuzufügen."
#: AKModel/availability/forms.py:88
#: AKModel/availability/forms.py:123
msgid "The submitted availability does not comply with the required format."
msgstr "Die eingetragenen Verfügbarkeit haben nicht das notwendige Format."
#: AKModel/availability/forms.py:101
#: AKModel/availability/forms.py:137
msgid "The submitted availability contains an invalid date."
msgstr "Die eingegebene Verfügbarkeit enthält ein ungültiges Datum."
#: AKModel/availability/forms.py:124 AKModel/availability/forms.py:134
#: AKModel/availability/forms.py:162 AKModel/availability/forms.py:172
msgid "Please fill in your availabilities!"
msgstr "Bitte Verfügbarkeiten eintragen!"
#: AKModel/availability/models.py:38 AKModel/models.py:57 AKModel/models.py:129
#: AKModel/models.py:184 AKModel/models.py:203 AKModel/models.py:224
#: AKModel/models.py:277 AKModel/models.py:354 AKModel/models.py:387
#: AKModel/models.py:458 AKModel/models.py:499 AKModel/models.py:664
#: AKModel/availability/models.py:44 AKModel/models.py:176
#: AKModel/models.py:552 AKModel/models.py:629 AKModel/models.py:662
#: AKModel/models.py:688 AKModel/models.py:707 AKModel/models.py:765
#: AKModel/models.py:934 AKModel/models.py:999 AKModel/models.py:1164
#: AKModel/models.py:1222 AKModel/models.py:1414 AKModel/models.py:1465
#: AKModel/models.py:1529
msgid "Event"
msgstr "Event"
#: AKModel/availability/models.py:39 AKModel/models.py:130
#: AKModel/models.py:185 AKModel/models.py:204 AKModel/models.py:225
#: AKModel/models.py:278 AKModel/models.py:355 AKModel/models.py:388
#: AKModel/models.py:459 AKModel/models.py:500 AKModel/models.py:665
#: AKModel/availability/models.py:45 AKModel/models.py:553
#: AKModel/models.py:630 AKModel/models.py:663 AKModel/models.py:689
#: AKModel/models.py:708 AKModel/models.py:766 AKModel/models.py:935
#: AKModel/models.py:1000 AKModel/models.py:1165 AKModel/models.py:1223
#: AKModel/models.py:1415 AKModel/models.py:1466 AKModel/models.py:1530
msgid "Associated event"
msgstr "Zugehöriges Event"
#: AKModel/availability/models.py:47
#: AKModel/availability/models.py:53
msgid "Person"
msgstr "Person"
#: AKModel/availability/models.py:48
#: AKModel/availability/models.py:54
msgid "Person whose availability this is"
msgstr "Person deren Verfügbarkeit hier abgebildet wird"
#: AKModel/availability/models.py:56 AKModel/models.py:358
#: AKModel/models.py:377 AKModel/models.py:508
#: AKModel/availability/models.py:62 AKModel/models.py:938
#: AKModel/models.py:989 AKModel/models.py:1232
msgid "Room"
msgstr "Raum"
#: AKModel/availability/models.py:57
#: AKModel/availability/models.py:63
msgid "Room whose availability this is"
msgstr "Raum dessen Verfügbarkeit hier abgebildet wird"
#: AKModel/availability/models.py:65 AKModel/models.py:286
#: AKModel/models.py:376 AKModel/models.py:453
#: AKModel/availability/models.py:71 AKModel/models.py:774
#: AKModel/models.py:988 AKModel/models.py:1159
msgid "AK"
msgstr "AK"
#: AKModel/availability/models.py:66
#: AKModel/availability/models.py:72
msgid "AK whose availability this is"
msgstr "Verfügbarkeiten"
#: AKModel/availability/models.py:74 AKModel/models.py:188
#: AKModel/models.py:514
#: AKModel/availability/models.py:80 AKModel/models.py:633
#: AKModel/models.py:1238
msgid "AK Category"
msgstr "AK-Kategorie"
#: AKModel/availability/models.py:75
#: AKModel/availability/models.py:81
msgid "AK Category whose availability this is"
msgstr "AK-Kategorie, deren Verfügbarkeit hier abgebildet wird"
#: AKModel/availability/models.py:249
#: AKModel/availability/models.py:89 AKModel/models.py:1457
#: AKModel/models.py:1532
msgid "Participant"
msgstr "Teilnehmer*in"
#: AKModel/availability/models.py:90
msgid "Participant whose availability this is"
msgstr "Teilnehmer*in, deren Verfügbarkeit hier abgebildet wird"
#: AKModel/availability/models.py:339 AKModel/models.py:823
msgid "Availabilities"
msgstr "Verfügbarkeiten"
#: AKModel/forms.py:43
#: AKModel/forms.py:78
msgid "Copy ak requirements and ak categories of existing event"
msgstr "AK-Anforderungen und AK-Kategorien eines existierenden Events kopieren"
#: AKModel/forms.py:44
#: AKModel/forms.py:79
msgid "You can choose what to copy in the next step"
msgstr ""
"Im nächsten Schritt kann ausgewählt werden, was genau kopiert werden soll"
#: AKModel/forms.py:52
#: AKModel/forms.py:93
msgid "Copy ak categories"
msgstr "AK-Kategorien kopieren"
#: AKModel/forms.py:59
#: AKModel/forms.py:100
msgid "Copy ak requirements"
msgstr "AK-Anforderungen kopieren"
#: AKModel/forms.py:80
#: AKModel/forms.py:107
msgid "Copy types"
msgstr "Typen kopieren"
#: AKModel/forms.py:133
msgid "Copy dashboard buttons"
msgstr "Dashboard-Buttons kopieren"
#: AKModel/forms.py:104
#: AKModel/forms.py:174
msgid "# next AKs"
msgstr "# nächste AKs"
#: AKModel/forms.py:105
#: AKModel/forms.py:175
msgid "How many next AKs should be shown on a slide?"
msgstr "Wie viele nächste AKs sollen auf einer Folie angezeigt werden?"
#: AKModel/forms.py:108
#: AKModel/forms.py:177 AKModel/models.py:712
msgid "AK Types"
msgstr "AK-Typen"
#: AKModel/forms.py:178
msgid "Which AK types should be included in the slides?"
msgstr "Welche AK-Typen sollen in den Folien enthalten sein?"
#: AKModel/forms.py:184
msgid "Presentation only?"
msgstr "Nur Vorstellung?"
#: AKModel/forms.py:110 AKModel/forms.py:117
#: AKModel/forms.py:186 AKModel/forms.py:193
msgid "Yes"
msgstr "Ja"
#: AKModel/forms.py:110 AKModel/forms.py:117
#: AKModel/forms.py:186 AKModel/forms.py:193
msgid "No"
msgstr "Nein"
#: AKModel/forms.py:112
#: AKModel/forms.py:188
msgid "Restrict AKs to those that asked for chance to be presented?"
msgstr "AKs auf solche, die um eine Vorstellung gebeten haben, einschränken?"
#: AKModel/forms.py:115
#: AKModel/forms.py:191
msgid "Space for notes in wishes?"
msgstr "Platz für Notizen bei den Wünschen?"
#: AKModel/forms.py:119
#: AKModel/forms.py:195
msgid ""
"Create symbols indicating space to note down owners and timeslots for "
"wishes, e.g., to be filled out on a touch screen while presenting?"
......@@ -213,11 +272,11 @@ msgstr ""
"fürWünsche markieren, z.B. um während der Präsentation auf einem Touchscreen "
"ausgefüllt zu werden?"
#: AKModel/forms.py:125 AKModel/models.py:658
#: AKModel/forms.py:204 AKModel/models.py:1408
msgid "Default Slots"
msgstr "Standardslots"
#: AKModel/forms.py:127
#: AKModel/forms.py:206
msgid ""
"Click and drag to add default slots, double-click to delete. Or use the "
"start and end inputs to add entries to the calendar view."
......@@ -226,11 +285,11 @@ msgstr ""
"Einträge zu löschen. Oder Start- und End-Eingabe verwenden, um der "
"Kalenderansicht neue Einträge hinzuzufügen."
#: AKModel/forms.py:137
#: AKModel/forms.py:222
msgid "New rooms"
msgstr "Neue Räume"
#: AKModel/forms.py:138
#: AKModel/forms.py:223
msgid ""
"Enter room details in CSV format. Required colum is \"name\", optional "
"colums are \"location\", \"capacity\", and \"url\" for online/hybrid rooms. "
......@@ -240,163 +299,212 @@ msgstr ""
"Spalten sind \"location\", \"capacity\", und \"url\" for Online-/"
"HybridräumeTrennzeichen: Semikolon"
#: AKModel/forms.py:149
#: AKModel/forms.py:229
msgid "Default availabilities?"
msgstr "Standardverfügbarkeiten?"
#: AKModel/forms.py:230
msgid "Create default availabilities for all rooms?"
msgstr "Standardverfügbarkeiten für alle Räume anlegen?"
#: AKModel/forms.py:246
msgid "CSV must contain a name column"
msgstr "CSV muss eine name-Spalte enthalten"
#: AKModel/metaviews/admin.py:97 AKModel/models.py:28
#: AKModel/metaviews/admin.py:156 AKModel/models.py:138
msgid "Start"
msgstr "Start"
#: AKModel/metaviews/admin.py:98
#: AKModel/metaviews/admin.py:157
msgid "Settings"
msgstr "Einstellungen"
#: AKModel/metaviews/admin.py:99
#: AKModel/metaviews/admin.py:158
msgid "Event created, Prepare Import"
msgstr "Event angelegt, Import vorbereiten"
#: AKModel/metaviews/admin.py:100
#: AKModel/metaviews/admin.py:159
msgid "Import categories & requirements"
msgstr "Kategorien & Anforderungen kopieren"
#: AKModel/metaviews/admin.py:101
#: AKModel/metaviews/admin.py:160
msgid "Activate?"
msgstr "Aktivieren?"
#: AKModel/metaviews/admin.py:102
#: AKModel/templates/admin/AKModel/event_wizard/activate.html:27
#: AKModel/metaviews/admin.py:161
#: AKModel/templates/admin/AKModel/event_wizard/activate.html:30
msgid "Finish"
msgstr "Abschluss"
#: AKModel/models.py:19 AKModel/models.py:176 AKModel/models.py:200
#: AKModel/models.py:222 AKModel/models.py:240 AKModel/models.py:346
#: AKModel/models.py:24
msgid "May not contain quotation marks"
msgstr "Darf keine Anführungszeichen enthalten"
#: AKModel/models.py:27
msgid "Must contain at least one letter or digit"
msgstr "Muss mindestens einen Buchstaben oder eine Ziffer enthalten"
#: AKModel/models.py:129 AKModel/models.py:621 AKModel/models.py:659
#: AKModel/models.py:686 AKModel/models.py:705 AKModel/models.py:723
#: AKModel/models.py:926
msgid "Name"
msgstr "Name"
#: AKModel/models.py:20
#: AKModel/models.py:130
msgid "Name or iteration of the event"
msgstr "Name oder Iteration des Events"
#: AKModel/models.py:21
#: AKModel/models.py:131
msgid "Short Form"
msgstr "Kurzer Name"
#: AKModel/models.py:22
#: AKModel/models.py:132
msgid "Short name of letters/numbers/dots/dashes/underscores used in URLs."
msgstr ""
"Kurzname bestehend aus Buchstaben, Nummern, Punkten und Unterstrichen zur "
"Nutzung in URLs"
#: AKModel/models.py:24
#: AKModel/models.py:134
msgid "Place"
msgstr "Ort"
#: AKModel/models.py:25
#: AKModel/models.py:135
msgid "City etc. the event takes place in"
msgstr "Stadt o.ä. in der das Event stattfindet"
#: AKModel/models.py:27
#: AKModel/models.py:137
msgid "Time Zone"
msgstr "Zeitzone"
#: AKModel/models.py:27
#: AKModel/models.py:137
msgid "Time Zone where this event takes place in"
msgstr "Zeitzone in der das Event stattfindet"
#: AKModel/models.py:28
#: AKModel/models.py:138
msgid "Time the event begins"
msgstr "Zeit zu der das Event beginnt"
#: AKModel/models.py:29
#: AKModel/models.py:139
msgid "End"
msgstr "Ende"
#: AKModel/models.py:29
#: AKModel/models.py:139
msgid "Time the event ends"
msgstr "Zeit zu der das Event endet"
#: AKModel/models.py:30
#: AKModel/models.py:140
msgid "Resolution Deadline"
msgstr "Resolutionsdeadline"
#: AKModel/models.py:31
#: AKModel/models.py:141
msgid "When should AKs with intention to submit a resolution be done?"
msgstr "Wann sollen AKs mit Resolutionsabsicht stattgefunden haben?"
#: AKModel/models.py:33
#: AKModel/models.py:143
msgid "Interest Window Start"
msgstr "Beginn Interessensbekundung"
#: AKModel/models.py:34
msgid "Opening time for expression of interest."
msgstr "Öffnungszeitpunkt für die Angabe von Interesse an AKs."
#: AKModel/models.py:145
msgid ""
"Opening time for expression of interest. When left blank, no interest "
"indication will be possible."
msgstr ""
"Öffnungszeitpunkt für die Angabe von Interesse an AKs.Wenn das Feld leer "
"bleibt, wird keine Abgabe von Interesse möglich sein."
#: AKModel/models.py:35
#: AKModel/models.py:148
msgid "Interest Window End"
msgstr "Ende Interessensbekundung"
#: AKModel/models.py:36
#: AKModel/models.py:149
msgid "Closing time for expression of interest."
msgstr "Öffnungszeitpunkt für die Angabe von Interesse an AKs."
#: AKModel/models.py:38
#: AKModel/models.py:151
msgid "Public event"
msgstr "Öffentliches Event"
#: AKModel/models.py:39
#: AKModel/models.py:152
msgid "Show this event on overview page."
msgstr "Zeige dieses Event auf der Übersichtseite an"
#: AKModel/models.py:41
#: AKModel/models.py:154
msgid "Active State"
msgstr "Aktiver Status"
#: AKModel/models.py:41
#: AKModel/models.py:154
msgid "Marks currently active events"
msgstr "Markiert aktuell aktive Events"
#: AKModel/models.py:42
#: AKModel/models.py:155
msgid "Plan Hidden"
msgstr "Plan verborgen"
#: AKModel/models.py:42
#: AKModel/models.py:155
msgid "Hides plan for non-staff users"
msgstr "Verbirgt den Plan für Nutzer*innen ohne erweiterte Rechte"
#: AKModel/models.py:44
#: AKModel/models.py:157
msgid "Plan published at"
msgstr "Plan veröffentlicht am/um"
#: AKModel/models.py:45
#: AKModel/models.py:158
msgid "Timestamp at which the plan was published"
msgstr "Zeitpunkt, zu dem der Plan veröffentlicht wurde"
#: AKModel/models.py:47
#: AKModel/models.py:160
msgid "Poll Hidden"
msgstr "Präferenzen-Abfrage verborgen"
#: AKModel/models.py:161
msgid "Hides preference poll for non-staff users"
msgstr "Verbirgt die Präferenzen-Abfrage für Nutzer*innen ohne erweiterte Rechte"
#: AKModel/models.py:163
msgid "Poll published at"
msgstr "Präferenzen-Abfrage veröffentlicht am/um"
#: AKModel/models.py:164
msgid "Timestamp at which the preference poll was published"
msgstr "Zeitpunkt, zu dem die Präferenzen-Abfrage veröffentlicht wurde"
#: AKModel/models.py:160
msgid "Base URL"
msgstr "URL-Prefix"
#: AKModel/models.py:47
#: AKModel/models.py:160
msgid "Prefix for wiki link construction"
msgstr "Prefix für die automatische Generierung von Wiki-Links"
#: AKModel/models.py:48
#: AKModel/models.py:161
msgid "Wiki Export Template Name"
msgstr "Wiki-Export Templatename"
#: AKModel/models.py:49
#: AKModel/models.py:162
msgid "Default Slot Length"
msgstr "Standardslotlänge"
#: AKModel/models.py:50
#: AKModel/models.py:163
msgid "Default length in hours that is assumed for AKs in this event."
msgstr "Standardlänge von Slots (in Stunden) für dieses Event"
#: AKModel/models.py:52
#: AKModel/models.py:164
msgid "Export Slot Length"
msgstr "Export-Slotlänge"
#: AKModel/models.py:166
msgid ""
"Slot duration in hours that is used in the timeslot discretization, when "
"this event is exported for the solver."
msgstr ""
"Länge von Slots (in Stunden) in der Zeitslot-Diskretisierung beim JSON-"
"Export dieses Events."
#: AKModel/models.py:171
msgid "Contact email address"
msgstr "E-Mail Kontaktadresse"
#: AKModel/models.py:54
#: AKModel/models.py:172
msgid ""
"An email address that is displayed on every page and can be used for all "
"kinds of questions"
......@@ -404,75 +512,118 @@ msgstr ""
"Eine Mailadresse die auf jeder Seite angezeigt wird und für alle Arten von "
"Fragen genutzt werden kann"
#: AKModel/models.py:58
#: AKModel/models.py:177
msgid "Events"
msgstr "Events"
#: AKModel/models.py:124
#: AKModel/models.py:446
msgid "Cannot parse malformed JSON input."
msgstr "Kann fehlerhafte JSON-Eingabe nicht verarbeiten"
#: AKModel/models.py:453
msgid "Data has changed since the export. Reexport and run the solver again."
msgstr ""
"Seit dem Export wurden die Daten verändert. Wiederhole den Export und führe "
"den Solver erneut aus."
#: AKModel/models.py:470
#, python-brace-format
msgid "AK {ak_name} is not assigned any timeslot by the solver"
msgstr "Dem AK {ak_name} wurde vom Solver kein Zeitslot zugewiesen"
#: AKModel/models.py:480
#, python-brace-format
msgid ""
"Duration of AK {ak_name} assigned by solver ({solver_duration} hours) is "
"less than the duration required by the slot ({slot_duration} hours)"
msgstr ""
"Die dem AK {ak_name} vom Solver zugewiesene Dauer ({solver_duration} "
"Stunden) ist kürzer als die aktuell vorgesehene Dauer des Slots "
"({slot_duration} Stunden)"
#: AKModel/models.py:494
#, python-brace-format
msgid ""
"Fixed AK {ak_name} assigned by solver to room {solver_room} is fixed to room "
"{slot_room}"
msgstr ""
"Dem fix geplanten AK {ak_name} wurde vom Solver Raum {solver_room} "
"zugewiesen, dabei ist der AK bereits fix in Raum {slot_room} eingeplant."
#: AKModel/models.py:505
#, python-brace-format
msgid ""
"Fixed AK {ak_name} assigned by solver to start at {solver_start} is fixed to "
"start at {slot_start}"
msgstr ""
"Dem fix geplanten AK {ak_name} wurde vom Solver die Startzeit {solver_start} "
"zugewiesen, dabei ist der AK bereits für {slot_start} eingeplant."
#: AKModel/models.py:545 AKModel/models.py:1461
msgid "Nickname"
msgstr "Spitzname"
#: AKModel/models.py:124
#: AKModel/models.py:547
msgid "Name to identify an AK owner by"
msgstr "Name, durch den eine AK-Leitung identifiziert wird"
#: AKModel/models.py:125
#: AKModel/models.py:548 AKModel/models.py:706
msgid "Slug"
msgstr "Slug"
#: AKModel/models.py:125
#: AKModel/models.py:548
msgid "Slug for URL generation"
msgstr "Slug für URL-Generierung"
#: AKModel/models.py:126
#: AKModel/models.py:549 AKModel/models.py:1463
msgid "Institution"
msgstr "Instutution"
#: AKModel/models.py:126
#: AKModel/models.py:549 AKModel/models.py:1463
msgid "Uni etc."
msgstr "Universität o.ä."
#: AKModel/models.py:127 AKModel/models.py:249
#: AKModel/models.py:550 AKModel/models.py:734
msgid "Web Link"
msgstr "Internet Link"
#: AKModel/models.py:127
#: AKModel/models.py:550
msgid "Link to Homepage"
msgstr "Link zu Homepage oder Webseite"
#: AKModel/models.py:133 AKModel/models.py:507
#: AKModel/models.py:556 AKModel/models.py:1231
msgid "AK Owner"
msgstr "AK-Leitung"
#: AKModel/models.py:134
#: AKModel/models.py:557
msgid "AK Owners"
msgstr "AK-Leitungen"
#: AKModel/models.py:176
#: AKModel/models.py:621
msgid "Name of the AK Category"
msgstr "Name der AK-Kategorie"
#: AKModel/models.py:177 AKModel/models.py:201
#: AKModel/models.py:622 AKModel/models.py:660
msgid "Color"
msgstr "Farbe"
#: AKModel/models.py:177 AKModel/models.py:201
#: AKModel/models.py:622 AKModel/models.py:660
msgid "Color for displaying"
msgstr "Farbe für die Anzeige"
#: AKModel/models.py:178 AKModel/models.py:243
#: AKModel/models.py:623 AKModel/models.py:728
msgid "Description"
msgstr "Beschreibung"
#: AKModel/models.py:179
#: AKModel/models.py:624
msgid "Short description of this AK Category"
msgstr "Beschreibung der AK-Kategorie"
#: AKModel/models.py:180
#: AKModel/models.py:625
msgid "Present by default"
msgstr "Defaultmäßig präsentieren"
#: AKModel/models.py:182
#: AKModel/models.py:626
msgid ""
"Present AKs of this category by default if AK owner did not specify whether "
"this AK should be presented?"
......@@ -480,132 +631,149 @@ msgstr ""
"AKs dieser Kategorie standardmäßig vorstellen, wenn die Leitungen das für "
"ihren AK nicht explizit spezifiziert haben?"
#: AKModel/models.py:189
#: AKModel/models.py:634
msgid "AK Categories"
msgstr "AK-Kategorien"
#: AKModel/models.py:200
#: AKModel/models.py:659
msgid "Name of the AK Track"
msgstr "Name des AK-Tracks"
#: AKModel/models.py:207
#: AKModel/models.py:666
msgid "AK Track"
msgstr "AK-Track"
#: AKModel/models.py:208
#: AKModel/models.py:667
msgid "AK Tracks"
msgstr "AK-Tracks"
#: AKModel/models.py:222
#: AKModel/models.py:686
msgid "Name of the Requirement"
msgstr "Name der Anforderung"
#: AKModel/models.py:228 AKModel/models.py:511
#: AKModel/models.py:692 AKModel/models.py:1235
msgid "AK Requirement"
msgstr "AK-Anforderung"
#: AKModel/models.py:229
#: AKModel/models.py:693
msgid "AK Requirements"
msgstr "AK-Anforderungen"
#: AKModel/models.py:240
#: AKModel/models.py:705
msgid "Name describing the type"
msgstr "Name, der den Typ beschreibt"
#: AKModel/models.py:711
msgid "AK Type"
msgstr "AK Typ"
#: AKModel/models.py:723
msgid "Name of the AK"
msgstr "Name des AKs"
#: AKModel/models.py:241
#: AKModel/models.py:725
msgid "Short Name"
msgstr "Kurzer Name"
#: AKModel/models.py:242
#: AKModel/models.py:727
msgid "Name displayed in the schedule"
msgstr "Name zur Anzeige im AK-Plan"
#: AKModel/models.py:243
#: AKModel/models.py:728
msgid "Description of the AK"
msgstr "Beschreibung des AKs"
#: AKModel/models.py:245
#: AKModel/models.py:730
msgid "Owners"
msgstr "Leitungen"
#: AKModel/models.py:246
#: AKModel/models.py:731
msgid "Those organizing the AK"
msgstr "Menschen, die den AK organisieren und halten"
#: AKModel/models.py:249
#: AKModel/models.py:734
msgid "Link to wiki page"
msgstr "Link zur Wiki Seite"
#: AKModel/models.py:250
#: AKModel/models.py:735
msgid "Protocol Link"
msgstr "Protokolllink"
#: AKModel/models.py:250
#: AKModel/models.py:735
msgid "Link to protocol"
msgstr "Link zum Protokoll"
#: AKModel/models.py:252
#: AKModel/models.py:737
msgid "Category"
msgstr "Kategorie"
#: AKModel/models.py:253
#: AKModel/models.py:738
msgid "Category of the AK"
msgstr "Kategorie des AKs"
#: AKModel/models.py:254
#: AKModel/models.py:739 AKModel/models.py:804 AKModel/views/manage.py:67
msgid "Types"
msgstr "Typen"
#: AKModel/models.py:740
msgid "This AK is"
msgstr "Dieser AK ist"
#: AKModel/models.py:741
msgid "Track"
msgstr "Track"
#: AKModel/models.py:255
#: AKModel/models.py:742
msgid "Track the AK belongs to"
msgstr "Track zu dem der AK gehört"
#: AKModel/models.py:257
#: AKModel/models.py:744
msgid "Resolution Intention"
msgstr "Resolutionsabsicht"
#: AKModel/models.py:258
#: AKModel/models.py:745
msgid "Intends to submit a resolution"
msgstr "Beabsichtigt eine Resolution einzureichen"
#: AKModel/models.py:259
#: AKModel/models.py:746
msgid "Present this AK"
msgstr "AK präsentieren"
#: AKModel/models.py:260
#: AKModel/models.py:747
msgid "Present results of this AK"
msgstr "Die Ergebnisse dieses AKs vorstellen"
#: AKModel/models.py:262 AKModel/views/status.py:138
#: AKModel/models.py:749 AKModel/models.py:802 AKModel/models.py:1468
#: AKModel/views/status.py:178
msgid "Requirements"
msgstr "Anforderungen"
#: AKModel/models.py:263
#: AKModel/models.py:750
msgid "AK's Requirements"
msgstr "Anforderungen des AKs"
#: AKModel/models.py:265
#: AKModel/models.py:752
msgid "Conflicting AKs"
msgstr "AK-Konflikte"
#: AKModel/models.py:266
#: AKModel/models.py:753
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"
#: AKModel/models.py:267
#: AKModel/models.py:754
msgid "Prerequisite AKs"
msgstr "Vorausgesetzte AKs"
#: AKModel/models.py:268
#: AKModel/models.py:755
msgid "AKs that should precede this AK in the schedule"
msgstr "AKs die im AK-Plan vor diesem AK stattfinden müssen"
#: AKModel/models.py:270
#: AKModel/models.py:757
msgid "Organizational Notes"
msgstr "Notizen zur Organisation"
#: AKModel/models.py:271
#: AKModel/models.py:758
msgid ""
"Notes to organizers. These are public. For private notes, please use the "
"button for private messages on the detail page of this AK (after creation/"
......@@ -615,291 +783,361 @@ msgstr ""
"Anmerkungen bitte den Button für Direktnachrichten verwenden (nach dem "
"Anlegen/Bearbeiten)."
#: AKModel/models.py:273
#: AKModel/models.py:761 AKModel/models.py:800
msgid "Interest"
msgstr "Interesse"
#: AKModel/models.py:273
#: AKModel/models.py:761
msgid "Expected number of people"
msgstr "Erwartete Personenzahl"
#: AKModel/models.py:274
#: AKModel/models.py:762
msgid "Interest Counter"
msgstr "Interessenszähler"
#: AKModel/models.py:275
#: AKModel/models.py:763
msgid "People who have indicated interest online"
msgstr "Anzahl Personen, die online Interesse bekundet haben"
#: AKModel/models.py:280
#: AKModel/models.py:768
msgid "Export?"
msgstr "Export?"
#: AKModel/models.py:281
#: AKModel/models.py:769
msgid "Include AK in wiki export?"
msgstr "AK bei Wiki-Export berücksichtigen?"
#: AKModel/models.py:287 AKModel/models.py:502
#: AKModel/templates/admin/AKModel/status/event_aks.html:10
#: AKModel/views/manage.py:55 AKModel/views/status.py:76
msgid "AKs"
msgstr "AKs"
#: AKModel/models.py:819
msgid "Conflicts"
msgstr "Konflikte"
#: AKModel/models.py:346
#: AKModel/models.py:822
msgid "Prerequisites"
msgstr "Voraussetzungen"
#: AKModel/models.py:926
msgid "Name or number of the room"
msgstr "Name oder Nummer des Raums"
#: AKModel/models.py:347
#: AKModel/models.py:927
msgid "Location"
msgstr "Ort"
#: AKModel/models.py:348
#: AKModel/models.py:928
msgid "Name or number of the location"
msgstr "Name oder Nummer des Ortes"
#: AKModel/models.py:349
#: AKModel/models.py:929
msgid "Capacity"
msgstr "Kapazität"
#: AKModel/models.py:350
#: AKModel/models.py:930
msgid "Maximum number of people (-1 for unlimited)."
msgstr "Maximale Personenzahl (-1 wenn unbeschränkt)."
#: AKModel/models.py:351
#: AKModel/models.py:931
msgid "Properties"
msgstr "Eigenschaften"
#: AKModel/models.py:352
#: AKModel/models.py:932
msgid "AK requirements fulfilled by the room"
msgstr "AK-Anforderungen, die dieser Raum erfüllt"
#: AKModel/models.py:359 AKModel/views/status.py:46
#: AKModel/models.py:939 AKModel/views/status.py:59
msgid "Rooms"
msgstr "Räume"
#: AKModel/models.py:376
#: AKModel/models.py:988
msgid "AK being mapped"
msgstr "AK, der zugeordnet wird"
#: AKModel/models.py:378
#: AKModel/models.py:990
msgid "Room the AK will take place in"
msgstr "Raum in dem der AK stattfindet"
#: AKModel/models.py:379 AKModel/models.py:661
#: AKModel/models.py:991 AKModel/models.py:1411
msgid "Slot Begin"
msgstr "Beginn des Slots"
#: AKModel/models.py:379 AKModel/models.py:661
#: AKModel/models.py:991 AKModel/models.py:1411
msgid "Time and date the slot begins"
msgstr "Zeit und Datum zu der der AK beginnt"
#: AKModel/models.py:381
#: AKModel/models.py:993
msgid "Duration"
msgstr "Dauer"
#: AKModel/models.py:382
#: AKModel/models.py:994
msgid "Length in hours"
msgstr "Länge in Stunden"
#: AKModel/models.py:384
#: AKModel/models.py:996
msgid "Scheduling fixed"
msgstr "Planung fix"
#: AKModel/models.py:385
#: AKModel/models.py:997
msgid "Length and time of this AK should not be changed"
msgstr "Dauer und Zeit dieses AKs sollten nicht verändert werden"
#: AKModel/models.py:390
#: AKModel/models.py:1002
msgid "Last update"
msgstr "Letzte Aktualisierung"
#: AKModel/models.py:393
#: AKModel/models.py:1005 AKModel/models.py:1535
msgid "AK Slot"
msgstr "AK-Slot"
#: AKModel/models.py:394 AKModel/models.py:504
#: AKModel/models.py:1006 AKModel/models.py:1228 AKModel/models.py:1263
msgid "AK Slots"
msgstr "AK-Slot"
#: AKModel/models.py:416 AKModel/models.py:425
#: AKModel/models.py:1028 AKModel/models.py:1037
msgid "Not scheduled yet"
msgstr "Noch nicht geplant"
#: AKModel/models.py:454
#: AKModel/models.py:1160
msgid "AK this message belongs to"
msgstr "AK zu dem die Nachricht gehört"
#: AKModel/models.py:455
#: AKModel/models.py:1161
msgid "Message text"
msgstr "Nachrichtentext"
#: AKModel/models.py:456
#: AKModel/models.py:1162
msgid "Message to the organizers. This is not publicly visible."
msgstr ""
"Nachricht an die Organisator*innen. Diese ist nicht öffentlich sichtbar."
#: AKModel/models.py:462
#: AKModel/models.py:1166
msgid "Resolved"
msgstr "Erledigt"
#: AKModel/models.py:1167
msgid "This message has been resolved (no further action needed)"
msgstr ""
"Diese Nachricht wurde vollständig bearbeitet (keine weiteren Aktionen "
"notwendig)"
#: AKModel/models.py:1170
msgid "AK Orga Message"
msgstr "AK-Organachricht"
#: AKModel/models.py:463
#: AKModel/models.py:1171
msgid "AK Orga Messages"
msgstr "AK-Organachrichten"
#: AKModel/models.py:472
#: AKModel/models.py:1189
msgid "Constraint Violation"
msgstr "Constraintverletzung"
#: AKModel/models.py:473 AKModel/views/status.py:95
#: AKModel/models.py:1190
msgid "Constraint Violations"
msgstr "Constraintverletzungen"
#: AKModel/models.py:477
#: AKModel/models.py:1197
msgid "Owner has two parallel slots"
msgstr "Leitung hat zwei Slots parallel"
#: AKModel/models.py:478
#: AKModel/models.py:1198
msgid "AK Slot was scheduled outside the AK's availabilities"
msgstr "AK Slot wurde außerhalb der Verfügbarkeit des AKs platziert"
#: AKModel/models.py:479
#: AKModel/models.py:1199
msgid "Room has two AK slots scheduled at the same time"
msgstr "Raum hat zwei AK Slots gleichzeitig"
#: AKModel/models.py:480
#: AKModel/models.py:1200
msgid "Room does not satisfy the requirement of the scheduled AK"
msgstr "Room erfüllt die Anforderungen des platzierten AKs nicht"
#: AKModel/models.py:481
#: AKModel/models.py:1201
msgid "AK Slot is scheduled at the same time as an AK listed as a conflict"
msgstr ""
"AK Slot wurde wurde zur gleichen Zeit wie ein Konflikt des AKs platziert"
#: AKModel/models.py:482
#: AKModel/models.py:1202
msgid "AK Slot is scheduled before an AK listed as a prerequisite"
msgstr "AK Slot wurde vor einem als Voraussetzung gelisteten AK platziert"
#: AKModel/models.py:484
#: AKModel/models.py:1204
msgid ""
"AK Slot for AK with intention to submit a resolution is scheduled after "
"resolution deadline"
msgstr ""
"AK Slot eines AKs mit Resoabsicht wurde nach der Resodeadline platziert"
#: AKModel/models.py:485
#: AKModel/models.py:1205
msgid "AK Slot in a category is outside that categories availabilities"
msgstr "AK Slot wurde außerhalb der Verfügbarkeiten seiner Kategorie"
#: AKModel/models.py:486
#: AKModel/models.py:1206
msgid "Two AK Slots for the same AK scheduled at the same time"
msgstr "Zwei AK Slots eines AKs wurden zur selben Zeit platziert"
#: AKModel/models.py:487
#: AKModel/models.py:1207
msgid "Room does not have enough space for interest in scheduled AK Slot"
msgstr "Room hat nicht genug Platz für das Interesse am geplanten AK-Slot"
#: AKModel/models.py:488
#: AKModel/models.py:1208
msgid "AK Slot is scheduled outside the event's availabilities"
msgstr "AK Slot wurde außerhalb der Verfügbarkeit des Events platziert"
#: AKModel/models.py:491
#: AKModel/models.py:1214
msgid "Warning"
msgstr "Warnung"
#: AKModel/models.py:492
#: AKModel/models.py:1215
msgid "Violation"
msgstr "Verletzung"
#: AKModel/models.py:494
#: AKModel/models.py:1217
msgid "Type"
msgstr "Art"
#: AKModel/models.py:495
#: AKModel/models.py:1218
msgid "Type of violation, i.e. what kind of constraint was violated"
msgstr "Art der Verletzung, gibt an welche Art Constraint verletzt wurde"
#: AKModel/models.py:496
#: AKModel/models.py:1219
msgid "Level"
msgstr "Level"
#: AKModel/models.py:497
#: AKModel/models.py:1220
msgid "Severity level of the violation"
msgstr "Schweregrad der Verletzung"
#: AKModel/models.py:503
#: AKModel/models.py:1227
msgid "AK(s) belonging to this constraint"
msgstr "AK(s), die zu diesem Constraint gehören"
#: AKModel/models.py:505
#: AKModel/models.py:1229
msgid "AK Slot(s) belonging to this constraint"
msgstr "AK Slot(s), die zu diesem Constraint gehören"
#: AKModel/models.py:507
#: AKModel/models.py:1231
msgid "AK Owner belonging to this constraint"
msgstr "AK Leitung(en), die zu diesem Constraint gehören"
#: AKModel/models.py:509
#: AKModel/models.py:1233
msgid "Room belonging to this constraint"
msgstr "Raum, der zu diesem Constraint gehört"
#: AKModel/models.py:512
#: AKModel/models.py:1236
msgid "AK Requirement belonging to this constraint"
msgstr "AK Anforderung, die zu diesem Constraint gehört"
#: AKModel/models.py:514
#: AKModel/models.py:1238
msgid "AK Category belonging to this constraint"
msgstr "AK Kategorie, di zu diesem Constraint gehört"
#: AKModel/models.py:516
#: AKModel/models.py:1240
msgid "Comment"
msgstr "Kommentar"
#: AKModel/models.py:516
#: AKModel/models.py:1240
msgid "Comment or further details for this violation"
msgstr "Kommentar oder weitere Details zu dieser Vereletzung"
#: AKModel/models.py:519
#: AKModel/models.py:1243
msgid "Timestamp"
msgstr "Timestamp"
#: AKModel/models.py:519
#: AKModel/models.py:1243
msgid "Time of creation"
msgstr "Zeitpunkt der ERstellung"
#: AKModel/models.py:520
#: AKModel/models.py:1244
msgid "Manually Resolved"
msgstr "Manuell behoben"
#: AKModel/models.py:521
#: AKModel/models.py:1245
msgid "Mark this violation manually as resolved"
msgstr "Markiere diese Verletzung manuell als behoben"
#: AKModel/models.py:548
#: AKModel/models.py:1272 AKModel/templates/admin/AKModel/aks_by_user.html:22
#: AKModel/templates/admin/AKModel/requirements_overview.html:27
msgid "Details"
msgstr "Details"
#: AKModel/models.py:657
#: AKModel/models.py:1407
msgid "Default Slot"
msgstr "Standardslot"
#: AKModel/models.py:662
#: AKModel/models.py:1412
msgid "Slot End"
msgstr "Ende des Slots"
#: AKModel/models.py:662
#: AKModel/models.py:1412
msgid "Time and date the slot ends"
msgstr "Zeit und Datum zu der der Slot endet"
#: AKModel/models.py:667
#: AKModel/models.py:1417
msgid "Primary categories"
msgstr "Primäre Kategorien"
#: AKModel/models.py:668
#: AKModel/models.py:1419
msgid "Categories that should be assigned to this slot primarily"
msgstr "Kategorieren, die diesem Slot primär zugewiesen werden sollen"
#: AKModel/site.py:10
#: AKModel/models.py:1458
msgid "Participants"
msgstr "Teilnehmende"
#: AKModel/models.py:1462
msgid ""
"Name to identify a participant by (in case of questions from the organizers)"
msgstr "Name, zur Identifikation bei Rückfragen von den Organisator*innen"
#: AKModel/models.py:1469
msgid "Participant's Requirements"
msgstr "Anforderungen der Teilnehmer*in"
#: AKModel/models.py:1472
#, python-brace-format
msgid "Anonymous {pk}"
msgstr "Anonym {pk}"
#: AKModel/models.py:1525
msgid "AK Preference"
msgstr "AK Präferenz"
#: AKModel/models.py:1526
msgid "AK Preferences"
msgstr "AK Präferenzen"
#: AKModel/models.py:1533
msgid "Participant this preference belongs to"
msgstr "Teilnehmer*in, zu der die Präferenz gehört"
#: AKModel/models.py:1536
msgid "AK this preference belongs to"
msgstr "AK zu dem die Präferenz gehört"
#: AKModel/models.py:1542
msgid "Ignore"
msgstr "Ignorieren"
#: AKModel/models.py:1487
msgid "Interested"
msgstr "Interessiert"
#: AKModel/models.py:1488
msgid "Great interest"
msgstr "Großes Interesse"
#: AKModel/models.py:1545
msgid "Required"
msgstr "Erforderlich"
#: AKModel/models.py:1547
msgid "Preference"
msgstr "Präferenz"
#: AKModel/models.py:1548
msgid "Preference level for the AK"
msgstr "Präferenz-Level für den AK"
#: AKModel/site.py:13 AKModel/site.py:14
msgid "Administration"
msgstr "Verwaltung"
......@@ -925,13 +1163,26 @@ msgid "Confirm"
msgstr "Bestätigen"
#: AKModel/templates/admin/AKModel/action_intermediate.html:27
#: AKModel/templates/admin/AKModel/event_wizard/import.html:24
#: AKModel/templates/admin/AKModel/event_wizard/settings.html:29
#: AKModel/templates/admin/AKModel/event_wizard/start.html:23
#: AKModel/templates/admin/AKModel/event_wizard/import.html:27
#: AKModel/templates/admin/AKModel/event_wizard/settings.html:32
#: AKModel/templates/admin/AKModel/event_wizard/start.html:28
#: AKModel/templates/admin/AKModel/room_create.html:30
msgid "Cancel"
msgstr "Abbrechen"
#: AKModel/templates/admin/AKModel/aks_by_user.html:8
msgid "AKs by Owner"
msgstr "AKs der Leitung"
#: AKModel/templates/admin/AKModel/aks_by_user.html:26
#: AKModel/templates/admin/AKModel/requirements_overview.html:31
msgid "Edit"
msgstr "Bearbeiten"
#: AKModel/templates/admin/AKModel/aks_by_user.html:33
msgid "This user does not have any AKs currently"
msgstr "Diese Leitung hat aktuell keine AKs"
#: AKModel/templates/admin/AKModel/event_wizard/activate.html:9
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:9
#: AKModel/templates/admin/AKModel/event_wizard/finish.html:9
......@@ -942,26 +1193,26 @@ msgstr "Abbrechen"
msgid "New event wizard"
msgstr "Assistent zum Anlegen eines neuen Events"
#: AKModel/templates/admin/AKModel/event_wizard/activate.html:18
#: AKModel/templates/admin/AKModel/event_wizard/activate.html:23
msgid "Successfully imported.<br><br>Do you want to activate your event now?"
msgstr "Erfolgreich importiert.<br><br>Soll das Event jetzt aktiviert werden?"
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:16
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:21
msgid "New event:"
msgstr "Neues Event:"
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:30
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:35
msgid "Your event was created and can now be further configured."
msgstr "Das Event wurde angelegt und kann nun weiter konfiguriert werden."
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:39
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:42
msgid "Skip Import"
msgstr "Import überspringen"
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:43
#: AKModel/templates/admin/AKModel/event_wizard/import.html:20
#: AKModel/templates/admin/AKModel/event_wizard/settings.html:22
#: AKModel/templates/admin/AKModel/event_wizard/start.html:19
#: AKModel/templates/admin/AKModel/event_wizard/created_prepare_import.html:46
#: AKModel/templates/admin/AKModel/event_wizard/import.html:23
#: AKModel/templates/admin/AKModel/event_wizard/settings.html:25
#: AKModel/templates/admin/AKModel/event_wizard/start.html:24
msgid "Continue"
msgstr "Fortfahren"
......@@ -969,11 +1220,11 @@ msgstr "Fortfahren"
msgid "Congratulations. Everything is set up!"
msgstr "Herzlichen Glückwunsch. Alles ist eingerichtet!"
#: AKModel/templates/admin/AKModel/event_wizard/settings.html:26
#: AKModel/templates/admin/AKModel/event_wizard/settings.html:29
msgid "Back"
msgstr "Zurück"
#: AKModel/templates/admin/AKModel/event_wizard/start.html:13
#: AKModel/templates/admin/AKModel/event_wizard/start.html:18
msgid ""
"Add a new event. Please start by filling these basic properties. You can "
"specify more settings later."
......@@ -998,16 +1249,12 @@ msgstr ""
msgid "Requirements Overview"
msgstr "Übersicht Anforderungen"
#: AKModel/templates/admin/AKModel/requirements_overview.html:31
msgid "Edit"
msgstr "Bearbeiten"
#: AKModel/templates/admin/AKModel/requirements_overview.html:38
msgid "No AKs with this requirement"
msgstr "Kein AK mit dieser Anforderung"
#: AKModel/templates/admin/AKModel/requirements_overview.html:45
#: AKModel/views/status.py:152
#: AKModel/views/status.py:194
msgid "Add Requirement"
msgstr "Anforderung hinzufügen"
......@@ -1060,7 +1307,7 @@ msgstr "Bisher keine Räume"
msgid "Active Events"
msgstr "Aktive Events"
#: AKModel/templates/admin/ak_index.html:16 AKModel/views/status.py:87
#: AKModel/templates/admin/ak_index.html:16 AKModel/views/status.py:113
msgid "Scheduling"
msgstr "Scheduling"
......@@ -1093,160 +1340,180 @@ msgstr "Login"
msgid "Register"
msgstr "Registrieren"
#: AKModel/views/ak.py:14
#: AKModel/views/ak.py:17
msgid "Requirements for Event"
msgstr "Anforderungen für das Event"
#: AKModel/views/ak.py:28
#: AKModel/views/ak.py:34
msgid "AK CSV Export"
msgstr "AK-CSV-Export"
#: AKModel/views/ak.py:42
#: AKModel/views/ak.py:48
msgid "AK Wiki Export"
msgstr "AK-Wiki-Export"
#: AKModel/views/ak.py:53 AKModel/views/manage.py:41
#: AKModel/views/ak.py:59 AKModel/views/manage.py:66
msgid "Wishes"
msgstr "Wünsche"
#: AKModel/views/ak.py:60
#: AKModel/views/ak.py:71
msgid "Delete AK Orga Messages"
msgstr "AK-Organachrichten löschen"
#: AKModel/views/ak.py:75
#: AKModel/views/ak.py:89
msgid "AK Orga Messages successfully deleted"
msgstr "AK-Organachrichten erfolgreich gelöscht"
#: AKModel/views/ak.py:82
#: AKModel/views/ak.py:101
msgid "Interest of the following AKs will be set to not filled (-1):"
msgstr "Interesse an den folgenden AKs wird auf nicht ausgefüllt (-1) gesetzt:"
#: AKModel/views/ak.py:83
#: AKModel/views/ak.py:102
msgid "Reset of interest in AKs successful."
msgstr "Interesse an AKs erfolgreich zurückgesetzt."
#: AKModel/views/ak.py:92
#: AKModel/views/ak.py:116
msgid "Interest counter of the following AKs will be set to 0:"
msgstr "Interessensbekundungszähler der folgenden AKs wird auf 0 gesetzt:"
#: AKModel/views/ak.py:93
#: AKModel/views/ak.py:117
msgid "AKs' interest counters set back to 0."
msgstr "Interessenszähler der AKs zurückgesetzt"
#: AKModel/views/event_wizard.py:69
#: AKModel/views/event_wizard.py:104
#, python-format
msgid "Copied '%(obj)s'"
msgstr "'%(obj)s' kopiert"
#: AKModel/views/event_wizard.py:72
#: AKModel/views/event_wizard.py:107
#, python-format
msgid "Could not copy '%(obj)s' (%(error)s)"
msgstr "'%(obj)s' konnte nicht kopiert werden (%(error)s)"
#: AKModel/views/manage.py:25 AKModel/views/status.py:127
#: AKModel/views/manage.py:36 AKModel/views/status.py:150
msgid "Export AK Slides"
msgstr "AK-Folien exportieren"
#: AKModel/views/manage.py:36
#: AKModel/views/manage.py:61
msgid "Symbols"
msgstr "Symbole"
#: AKModel/views/manage.py:37
#: AKModel/views/manage.py:62
msgid "Who?"
msgstr "Wer?"
#: AKModel/views/manage.py:38
#: AKModel/views/manage.py:63
msgid "Duration(s)"
msgstr "Dauer(n)"
#: AKModel/views/manage.py:39
#: AKModel/views/manage.py:64
msgid "Reso intention?"
msgstr "Resolutionsabsicht?"
#: AKModel/views/manage.py:40
#: AKModel/views/manage.py:65
msgid "Category (for Wishes)"
msgstr "Kategorie (für Wünsche)"
#: AKModel/views/manage.py:77
#: AKModel/views/manage.py:84
msgid "Type(s)"
msgstr "Typ(en)"
#: AKModel/views/manage.py:126
msgid "The following Constraint Violations will be marked as manually resolved"
msgstr ""
"Die folgenden Constraintverletzungen werden als manuell behoben markiert."
#: AKModel/views/manage.py:78
#: AKModel/views/manage.py:127
msgid "Constraint Violations marked as resolved"
msgstr "Constraintverletzungen als manuell behoben markiert"
#: AKModel/views/manage.py:87
#: AKModel/views/manage.py:139
msgid "The following Constraint Violations will be set to level 'violation'"
msgstr ""
"Die folgenden Constraintverletzungen werden auf das Level \"Violation\" "
"gesetzt."
#: AKModel/views/manage.py:88
#: AKModel/views/manage.py:140
msgid "Constraint Violations set to level 'violation'"
msgstr "Constraintverletzungen auf Level \"Violation\" gesetzt"
#: AKModel/views/manage.py:97
#: AKModel/views/manage.py:152
msgid "The following Constraint Violations will be set to level 'warning'"
msgstr ""
"Die folgenden Constraintverletzungen werden auf das Level 'warning' gesetzt."
#: AKModel/views/manage.py:98
#: AKModel/views/manage.py:153
msgid "Constraint Violations set to level 'warning'"
msgstr "Constraintverletzungen auf Level \"Warning\" gesetzt"
#: AKModel/views/manage.py:107
#: AKModel/views/manage.py:165
msgid "Publish the plan(s) of:"
msgstr "Den Plan/die Pläne veröffentlichen von:"
#: AKModel/views/manage.py:108
#: AKModel/views/manage.py:166
msgid "Plan published"
msgstr "Plan veröffentlicht"
#: AKModel/views/manage.py:117
#: AKModel/views/manage.py:178
msgid "Unpublish the plan(s) of:"
msgstr "Den Plan/die Pläne verbergen von:"
#: AKModel/views/manage.py:118
#: AKModel/views/manage.py:179
msgid "Plan unpublished"
msgstr "Plan verborgen"
#: AKModel/views/manage.py:127 AKModel/views/status.py:111
#: AKModel/views/manage.py:168
msgid "Publish the poll(s) of:"
msgstr "Die Präferenzen-Abfrage(n) veröffentlichen von:"
#: AKModel/views/manage.py:169
msgid "Preference poll published"
msgstr "Präferenzen-Abfrage veröffentlicht"
#: AKModel/views/manage.py:181
msgid "Unpublish the preference poll(s) of:"
msgstr "Die Präferenzen-Abfrage(n) verbergen von:"
#: AKModel/views/manage.py:182
msgid "Preference poll unpublished"
msgstr "Präferenzen-Abfrage verborgen"
#: AKModel/views/manage.py:191 AKModel/views/status.py:134
msgid "Edit Default Slots"
msgstr "Standardslots bearbeiten"
#: AKModel/views/manage.py:164
#: AKModel/views/manage.py:229
#, python-brace-format
msgid "Could not update slot {id} since it does not belong to {event}"
msgstr ""
"Konnte Slot {id} nicht bearbeiten, da er nicht zum Event {event} gehört"
#: AKModel/views/manage.py:194
#: AKModel/views/manage.py:260
#, python-brace-format
msgid "Updated {u} slot(s). created {c} new slot(s) and deleted {d} slot(s)"
msgstr ""
"{u} Slot(s) aktualisiert, {c} Slot(s) hinzugefügt und {d} Slot(s) gelöscht"
#: AKModel/views/room.py:31
#: AKModel/views/room.py:37
#, python-format
msgid "Created Room '%(room)s'"
msgstr "Raum '%(room)s angelegt"
msgstr "Raum '%(room)s' angelegt"
#: AKModel/views/room.py:37 AKModel/views/status.py:66
#: AKModel/views/room.py:51 AKModel/views/status.py:86
msgid "Import Rooms from CSV"
msgstr "Räume aus CSV importieren"
#: AKModel/views/room.py:68
#: AKModel/views/room.py:96
#, python-brace-format
msgid "Could not import room {name}: {e}"
msgstr "Konnte Raum {name} nicht importieren: {e}"
#: AKModel/views/room.py:72
#: AKModel/views/room.py:101
#, python-brace-format
msgid "Imported {count} room(s)"
msgstr "{count} Raum/Räume importiert"
#: AKModel/views/room.py:74
#: AKModel/views/room.py:103
msgid "No rooms imported"
msgstr "Keine Räume importiert"
......@@ -1254,46 +1521,61 @@ msgstr "Keine Räume importiert"
msgid "Overview"
msgstr "Überblick"
#: AKModel/views/status.py:26
#: AKModel/views/status.py:32
msgid "Categories"
msgstr "Kategorien"
#: AKModel/views/status.py:30
#: AKModel/views/status.py:36
msgid "Add category"
msgstr "Kategorie hinzufügen"
#: AKModel/views/status.py:50
#: AKModel/views/status.py:63
msgid "Add Room"
msgstr "Raum hinzufügen"
#: AKModel/views/status.py:100
#: AKModel/views/status.py:120
msgid "AKs requiring special attention"
msgstr "AKs, die besondere Aufmerksamkeit benötigen"
#: AKModel/views/status.py:104
#: AKModel/views/status.py:126
msgid "Enter Interest"
msgstr "Interesse erfassen"
#: AKModel/views/status.py:115
#: AKModel/views/status.py:138
msgid "Manage ak tracks"
msgstr "AK-Tracks verwalten"
#: AKModel/views/status.py:119
#: AKModel/views/status.py:142
msgid "Export AKs as CSV"
msgstr "AKs als CSV exportieren"
#: AKModel/views/status.py:123
#: AKModel/views/status.py:146
msgid "Export AKs for Wiki"
msgstr "AKs im Wiki-Format exportieren"
#: AKModel/views/status.py:148
#: AKModel/views/status.py:158
msgid "Export AKs as JSON"
msgstr "AKs als JSON exportieren"
#: AKModel/views/status.py:162
msgid "Import AK schedule from JSON"
msgstr "AK-Plan aus JSON importieren"
#: AKModel/views/status.py:190
msgid "Show AKs for requirements"
msgstr "Zu Anforderungen gehörige AKs anzeigen"
#: AKModel/views/status.py:159
#: AKModel/views/status.py:204
msgid "Event Status"
msgstr "Eventstatus"
#, python-format
#~ msgid "Invalid JSON format: field '%(field)s' is missing"
#~ msgstr "Ungültige JSON-Eingabe: das Feld '%(field)s' fehlt"
#~ msgid "Opening time for expression of interest."
#~ msgstr "Öffnungszeitpunkt für die Angabe von Interesse an AKs."
#~ msgid "Messages"
#~ msgstr "Nachrichten"
......
"""
Ensure PO files are generated using forward slashes in the location comments on all operating systems
"""
import os
from django.core.management.commands.makemessages import Command as MakeMessagesCommand
class Command(MakeMessagesCommand):
"""
Adapted version of the :class:`MakeMessagesCommand`
Ensure PO files are generated using forward slashes in the location comments on all operating systems
"""
def find_files(self, root):
# Replace backward slashes with forward slashes if necessary in file list
all_files = super().find_files(root)
if os.sep != "\\":
return all_files
......@@ -21,17 +23,19 @@ class Command(MakeMessagesCommand):
return all_files
def build_potfiles(self):
# Replace backward slashes with forward slashes if necessary in the files itself
pot_files = super().build_potfiles()
if os.sep != "\\":
return pot_files
for filename in pot_files:
lines = open(filename, "r", encoding="utf-8").readlines()
fixed_lines = []
for line in lines:
if line.startswith("#: "):
line = line.replace("\\", "/")
fixed_lines.append(line)
with open(filename, "r", encoding="utf-8") as f:
lines = f.readlines()
fixed_lines = []
for line in lines:
if line.startswith("#: "):
line = line.replace("\\", "/")
fixed_lines.append(line)
with open(filename, "w", encoding="utf-8") as f:
f.writelines(fixed_lines)
......
from AKModel.metaviews.status import StatusManager
# create on instance of the :class:`AKModel.metaviews.status.StatusManager`
# that can then be accessed everywhere (singleton pattern)
status_manager = StatusManager()
......@@ -13,36 +13,61 @@ from AKModel.models import Event
class EventSlugMixin:
"""
Mixin to handle views with event slugs
This will make the relevant event available as self.event in all kind types of requests
(generic GET and POST views, list views, dispatching, create views)
"""
# pylint: disable=no-member
event = None
def _load_event(self):
"""
Perform the real loading of the event data (as specified by event_slug in the URL) into self.event
"""
# Find event based on event slug
if self.event is None:
self.event = get_object_or_404(Event, slug=self.kwargs.get("event_slug", None))
def get(self, request, *args, **kwargs):
"""
Override GET request handling to perform loading event first
"""
self._load_event()
return super().get(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
"""
Override POST request handling to perform loading event first
"""
self._load_event()
return super().post(request, *args, **kwargs)
def list(self, request, *args, **kwargs):
"""
Override list view request handling to perform loading event first
"""
self._load_event()
return super().list(request, *args, **kwargs)
def create(self, request, *args, **kwargs):
"""
Override create view request handling to perform loading event first
"""
self._load_event()
return super().create(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs):
"""
Override dispatch which is called in many generic views to perform loading event first
"""
if self.event is None:
self._load_event()
return super().dispatch(request, *args, **kwargs)
def get_context_data(self, *, object_list=None, **kwargs):
"""
Override `get_context_data` to make the event information available in the rendering context as `event`. too
"""
context = super().get_context_data(object_list=object_list, **kwargs)
# Add event to context (to make it accessible in templates)
context["event"] = self.event
......@@ -55,15 +80,29 @@ class FilterByEventSlugMixin(EventSlugMixin):
"""
def get_queryset(self):
# Filter current queryset based on url event slug or return 404 if event slug is invalid
"""
Get adapted queryset:
Filter current queryset based on url event slug or return 404 if event slug is invalid
:return: Queryset
"""
return super().get_queryset().filter(event=self.event)
class AdminViewMixin:
"""
Mixin to provide context information needed in custom admin views
Will either use default information for `site_url` and `title` or allows to set own values for that
"""
# pylint: disable=too-few-public-methods
site_url = ''
title = ''
def get_context_data(self, **kwargs):
"""
Extend context
"""
extra = admin.site.each_context(self.request)
extra.update(super().get_context_data(**kwargs))
......@@ -76,10 +115,19 @@ class AdminViewMixin:
class IntermediateAdminView(AdminViewMixin, FormView):
"""
Metaview: Handle typical "action but with preview and confirmation step before" workflow
"""
template_name = "admin/AKModel/action_intermediate.html"
form_class = AdminIntermediateForm
def get_preview(self):
"""
Render a preview of the action to be performed.
Default is empty
:return: preview (html)
:rtype: str
"""
return ""
def get_context_data(self, **kwargs):
......@@ -90,7 +138,18 @@ class IntermediateAdminView(AdminViewMixin, FormView):
class WizardViewMixin:
"""
Mixin to create wizard-like views.
This visualizes the progress of the user in the creation process and provides the interlinking to the next step
In the current implementation, the steps of the wizard are hardcoded here,
hence this mixin can only be used for the event creation wizard
"""
# pylint: disable=too-few-public-methods
def get_context_data(self, **kwargs):
"""
Extend context
"""
context = super().get_context_data(**kwargs)
context["wizard_step"] = self.wizard_step
context["wizard_steps"] = [
......@@ -107,10 +166,23 @@ class WizardViewMixin:
class IntermediateAdminActionView(IntermediateAdminView, ABC):
"""
Abstract base view: Intermediate action view (preview & confirmation see :class:`IntermediateAdminView`)
for custom admin actions (marking multiple objects in a django admin model instances list with a checkmark and then
choosing an action from the dropdown).
This will automatically handle the decoding of the URL encoding of the list of primary keys django does to select
which objects the action should be run on, then display a preview, perform the action after confirmation and
redirect again to the object list including display of a confirmation message
"""
# pylint: disable=no-member
form_class = AdminIntermediateActionForm
entities = None
def get_queryset(self, pks=None):
"""
Get the queryset of objects to perform the action on
"""
if pks is None:
pks = self.request.GET['pks']
return self.model.objects.filter(pk__in=pks.split(","))
......@@ -130,7 +202,10 @@ class IntermediateAdminActionView(IntermediateAdminView, ABC):
@abstractmethod
def action(self, form):
pass
"""
The real action to perform
:param form: form holding the data probably needed for the action
"""
def form_valid(self, form):
self.entities = self.get_queryset(pks=form.cleaned_data['pks'])
......@@ -140,7 +215,21 @@ class IntermediateAdminActionView(IntermediateAdminView, ABC):
class LoopActionMixin(ABC):
def action(self, form):
"""
Mixin for the typical kind of action where one needs to loop over all elements
and perform a certain function on each of them
The action is performed by overriding `perform_action(self, entity)`
further customization can be reached with the two callbacks `pre_action()` and `post_action()`
that are called before and after performing the action loop
"""
def action(self, form): # pylint: disable=unused-argument
"""
The real action to perform.
Will perform the loop, perform the action on each aelement and call the callbacks
:param form: form holding the data probably needed for the action
"""
self.pre_action()
for entity in self.entities:
self.perform_action(entity)
......@@ -149,10 +238,18 @@ class LoopActionMixin(ABC):
@abstractmethod
def perform_action(self, entity):
pass
"""
Action to perform on each entity
:param entity: entity to perform the action on
"""
def pre_action(self):
pass
"""
Callback for custom action before loop starts
"""
def post_action(self):
pass
"""
Callback for custom action after loop finished
"""
......@@ -8,6 +8,9 @@ from AKModel.metaviews.admin import AdminViewMixin
class StatusWidget(ABC):
"""
Abstract parent for status page widgets
"""
title = "Status Widget"
actions = []
status = "primary"
......@@ -18,7 +21,6 @@ class StatusWidget(ABC):
"""
Which model/context is needed to render this widget?
"""
pass
def get_context_data(self, context) -> dict:
"""
......@@ -32,6 +34,7 @@ class StatusWidget(ABC):
Render widget based on context
:param context: Context for rendering
:param request: HTTP request, needed for rendering
:return: Dictionary containing the rendered/prepared information
"""
context = self.get_context_data(context)
......@@ -42,7 +45,7 @@ class StatusWidget(ABC):
"status": self.render_status(context),
}
def render_title(self, context: {}) -> str:
def render_title(self, context: {}) -> str: # pylint: disable=unused-argument
"""
Render title for widget based on context
......@@ -52,7 +55,7 @@ class StatusWidget(ABC):
"""
return self.title
def render_status(self, context: {}) -> str:
def render_status(self, context: {}) -> str: # pylint: disable=unused-argument
"""
Render status for widget based on context
......@@ -63,16 +66,16 @@ class StatusWidget(ABC):
return self.status
@abstractmethod
def render_body(self, context: {}, request) -> str:
def render_body(self, context: {}, request) -> str: # pylint: disable=unused-argument
"""
Render body for widget based on context
:param context: Context for rendering
:param request: HTTP request (needed for rendering)
:return: Rendered widget body (HTML)
"""
pass
def render_actions(self, context: {}) -> list[dict]:
def render_actions(self, context: {}) -> list[dict]: # pylint: disable=unused-argument
"""
Render actions for widget based on context
......@@ -81,16 +84,30 @@ class StatusWidget(ABC):
:param context: Context for rendering
:return: List of actions
"""
return [a for a in self.actions]
return self.actions
class TemplateStatusWidget(StatusWidget):
"""
A :class:`StatusWidget` that produces its content by rendering a given html template
"""
@property
@abstractmethod
def template_name(self) -> str:
pass
"""
Configure the template to use
:return: name of the template to use
"""
def render_body(self, context: {}, request) -> str:
"""
Render the body of the widget using the template rendering method from django
(load and render template using the provided context)
:param context: context to use for rendering
:param request: HTTP request (needed by django)
:return: rendered content (HTML)
"""
template = loader.get_template(self.template_name)
return template.render(context, request)
......@@ -98,6 +115,8 @@ class TemplateStatusWidget(StatusWidget):
class StatusManager:
"""
Registry for all status widgets
Allows to register status widgets using the `@status_manager.register(name="xyz")` decorator
"""
widgets = {}
widgets_by_context_type = defaultdict(list)
......@@ -131,6 +150,9 @@ class StatusManager:
class StatusView(ABC, AdminViewMixin, TemplateView):
"""
Abstract view: A generic base view to create a status page holding multiple widgets
"""
template_name = "admin/AKModel/status/status.html"
@property
......@@ -139,12 +161,15 @@ class StatusView(ABC, AdminViewMixin, TemplateView):
"""
Which model/context is provided by this status view?
"""
pass
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
from AKModel.metaviews import status_manager
context['widgets'] = [w.render(context, self.request) for w in status_manager.get_by_context_type(self.provided_context_type)]
# Load status manager (local import to prevent cyclic import)
from AKModel.metaviews import status_manager # pylint: disable=import-outside-toplevel
# Render all widgets and provide them as part of the context
context['widgets'] = [w.render(context, self.request)
for w in status_manager.get_by_context_type(self.provided_context_type)]
return self.render_to_response(context)
# Generated by Django 4.1.9 on 2023-05-15 18:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0057_upgrades'),
]
operations = [
migrations.AlterModelOptions(
name='ak',
options={'ordering': ['pk'], 'verbose_name': 'AK', 'verbose_name_plural': 'AKs'},
),
]
# Generated by Django 4.2.11 on 2024-04-21 14:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0058_alter_ak_options'),
]
operations = [
migrations.AlterField(
model_name='event',
name='interest_start',
field=models.DateTimeField(blank=True, help_text='Opening time for expression of interest. When left blank, no interest indication will be possible.', null=True, verbose_name='Interest Window Start'),
),
]
# Generated by Django 4.2.11 on 2024-04-24 21:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0059_interest_default'),
]
operations = [
migrations.AddField(
model_name='akorgamessage',
name='resolved',
field=models.BooleanField(default=False, help_text='This message has been resolved (no further action needed)', verbose_name='Resolved'),
),
]
# Generated by Django 4.2.13 on 2025-02-25 20:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0060_orga_message_resolved'),
]
operations = [
migrations.CreateModel(
name='AKType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Name describing the type', max_length=128, verbose_name='Name')),
('event', models.ForeignKey(help_text='Associated event', on_delete=django.db.models.deletion.CASCADE, to='AKModel.event', verbose_name='Event')),
],
options={
'verbose_name': 'AK Type',
'verbose_name_plural': 'AK Types',
'ordering': ['name'],
'unique_together': {('event', 'name')},
},
),
migrations.AddField(
model_name='ak',
name='types',
field=models.ManyToManyField(blank=True, help_text='This AK is', to='AKModel.aktype', verbose_name='Types'),
),
]
# Generated by Django 4.2.13 on 2025-02-26 22:35
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0061_types'),
]
operations = [
migrations.RemoveField(
model_name='historicalak',
name='interest',
),
]
# Generated by Django 4.2.13 on 2025-03-03 19:59
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0062_interest_no_history'),
]
operations = [
migrations.AlterField(
model_name='ak',
name='name',
field=models.CharField(help_text='Name of the AK', max_length=256, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+'), django.core.validators.RegexValidator(message='Must contain at least one letter or digit', regex='[\\w\\s]+')], 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, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+')], verbose_name='Short Name'),
),
migrations.AlterField(
model_name='akowner',
name='name',
field=models.CharField(help_text='Name to identify an AK owner by', max_length=64, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+'), django.core.validators.RegexValidator(message='Must contain at least one letter or digit', regex='[\\w\\s]+')], verbose_name='Nickname'),
),
migrations.AlterField(
model_name='historicalak',
name='name',
field=models.CharField(help_text='Name of the AK', max_length=256, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+'), django.core.validators.RegexValidator(message='Must contain at least one letter or digit', regex='[\\w\\s]+')], verbose_name='Name'),
),
migrations.AlterField(
model_name='historicalak',
name='short_name',
field=models.CharField(blank=True, help_text='Name displayed in the schedule', max_length=64, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+')], verbose_name='Short Name'),
),
]
# Generated by Django 5.1.6 on 2025-03-29 22:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("AKModel", "0063_field_validators"),
]
operations = [
migrations.AddField(
model_name="event",
name="export_slot",
field=models.DecimalField(
decimal_places=2,
default=1,
help_text="Slot duration in hours that is used in the timeslot discretization, when this event is exported for the solver.",
max_digits=4,
verbose_name="Export Slot Length",
),
),
]
# Generated by Django 4.2.13 on 2025-02-10 10:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("AKModel", "0064_event_export_slot"),
]
operations = [
migrations.CreateModel(
name="EventParticipant",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(
blank=True,
help_text="Name to identify a participant by (in case of questions from the organizers)",
max_length=64,
verbose_name="Nickname",
),
),
(
"institution",
models.CharField(
blank=True,
help_text="Uni etc.",
max_length=128,
verbose_name="Institution",
),
),
(
"event",
models.ForeignKey(
help_text="Associated event",
on_delete=django.db.models.deletion.CASCADE,
to="AKModel.event",
verbose_name="Event",
),
),
],
options={
"verbose_name": "Participant",
"verbose_name_plural": "Participants",
"ordering": ["name"],
},
),
migrations.CreateModel(
name="AKPreference",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"preference",
models.PositiveSmallIntegerField(
choices=[
(0, "Ignore"),
(1, "Prefer"),
(2, "Strong prefer"),
(3, "Required"),
],
default=0,
help_text="Preference level for the AK",
verbose_name="Preference",
),
),
(
"ak",
models.ForeignKey(
help_text="AK this preference belongs to",
on_delete=django.db.models.deletion.CASCADE,
to="AKModel.ak",
verbose_name="AK",
),
),
(
"event",
models.ForeignKey(
help_text="Associated event",
on_delete=django.db.models.deletion.CASCADE,
to="AKModel.event",
verbose_name="Event",
),
),
(
"participant",
models.ForeignKey(
help_text="Participant this preference belongs to",
on_delete=django.db.models.deletion.CASCADE,
to="AKModel.eventparticipant",
verbose_name="Participant",
),
),
],
options={
"verbose_name": "AK Preference",
"verbose_name_plural": "AK Preferences",
},
),
migrations.AddField(
model_name="availability",
name="participant",
field=models.ForeignKey(
blank=True,
help_text="Participant whose availability this is",
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="availabilities",
to="AKModel.eventparticipant",
verbose_name="Participant",
),
),
]
# Generated by Django 4.2.13 on 2025-02-10 22:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("AKModel", "0065_eventparticipant_akpreference_and_more"),
]
operations = [
migrations.AddField(
model_name="akpreference",
name="slot",
field=models.ForeignKey(
default=None,
help_text="AKSlot this preference belongs to",
on_delete=django.db.models.deletion.CASCADE,
to="AKModel.akslot",
verbose_name="AKSlot",
),
preserve_default=False,
),
migrations.AlterUniqueTogether(
name="akpreference",
unique_together={("event", "participant", "slot")},
),
migrations.RemoveField(
model_name="akpreference",
name="ak",
),
]
# Generated by Django 4.2.13 on 2025-02-11 00:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
(
"AKModel",
"0066_akpreference_slot_alter_akpreference_unique_together_and_more",
),
]
operations = [
migrations.AddField(
model_name="eventparticipant",
name="requirements",
field=models.ManyToManyField(
blank=True,
help_text="Participant's Requirements",
to="AKModel.akrequirement",
verbose_name="Requirements",
),
),
migrations.AlterField(
model_name="akpreference",
name="slot",
field=models.ForeignKey(
help_text="AK Slot this preference belongs to",
on_delete=django.db.models.deletion.CASCADE,
to="AKModel.akslot",
verbose_name="AK Slot",
),
),
]
# Generated by Django 5.1.6 on 2025-05-11 15:21
from django.db import migrations, models
def create_slugs(apps, schema_editor):
"""
Automatically generate slugs from existing type names
"""
AKType = apps.get_model("AKModel", "AKType")
for ak_type in AKType.objects.all():
slug = ak_type.name.lower().split(" ")[0]
ak_type.slug = slug[:30] if len(slug) > 30 else slug
ak_type.save()
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0067_eventparticipant_requirements_and_more'),
]
operations = [
migrations.AddField(
model_name='aktype',
name='slug',
field=models.SlugField(max_length=30, null=True, verbose_name='Slug'),
),
migrations.RunPython(create_slugs, migrations.RunPython.noop),
migrations.AlterUniqueTogether(
name='aktype',
unique_together={('event', 'name')},
),
migrations.AlterField(
model_name='aktype',
name='slug',
field=models.SlugField(max_length=30, verbose_name='Slug'),
),
migrations.AlterUniqueTogether(
name='aktype',
unique_together={('event', 'name'), ('event', 'slug')},
),
]
# Generated by Django 5.2.1 on 2025-06-17 15:57
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0067_eventparticipant_requirements_and_more'),
('AKPreference', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='eventparticipant',
name='event',
),
migrations.RemoveField(
model_name='eventparticipant',
name='requirements',
),
migrations.RemoveField(
model_name='availability',
name='participant',
),
migrations.AddField(
model_name='event',
name='poll_hidden',
field=models.BooleanField(default=True, help_text='Hides preference poll for non-staff users', verbose_name='Poll Hidden'),
),
migrations.AddField(
model_name='event',
name='poll_published_at',
field=models.DateTimeField(blank=True, help_text='Timestamp at which the preference poll was published', null=True, verbose_name='Poll published at'),
),
migrations.DeleteModel(
name='AKPreference',
),
migrations.DeleteModel(
name='EventParticipant',
),
migrations.AddField(
model_name='availability',
name='participant',
field=models.ForeignKey(blank=True, help_text='Participant whose availability this is', null=True,
on_delete=django.db.models.deletion.CASCADE, related_name='availabilities',
to='AKPreference.eventparticipant', verbose_name='Participant'),
),
]
# Generated by Django 5.2.1 on 2025-06-17 18:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0068_aktype_slug'),
('AKModel', '0068_event_export_delete_preferences_participants'),
]
operations = [
]
import itertools
from datetime import timedelta
import json
import math
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Any, Generator, Iterable
from django.db import models
from django.apps import apps
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models, transaction
from django.db.models import Count
from django.urls import reverse_lazy
from django.utils import timezone
from django.utils.datetime_safe import datetime
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
from simple_history.models import HistoricalRecords
from timezone_field import TimeZoneField
# Custom validators to be used for some of the fields
# Prevent inclusion of the quotation marks ' " ´ `
# This may be necessary to prevent javascript issues
no_quotation_marks_validator = RegexValidator(regex=r"['\"´`]+", inverse_match=True,
message=_('May not contain quotation marks'))
# Enforce that the field contains of at least one letter or digit (and not just special characters
# This prevents issues when autogenerating slugs from that field
slugable_validator = RegexValidator(regex=r"[\w\s]+", message=_('Must contain at least one letter or digit'))
@dataclass
class OptimizerTimeslot:
"""Class describing a discrete timeslot. Used to interface with an optimizer."""
avail: "Availability"
"""The availability object corresponding to this timeslot."""
idx: int
"""The unique index of this optimizer timeslot."""
constraints: set[str]
"""The set of time constraints fulfilled by this object."""
def merge(self, other: "OptimizerTimeslot") -> "OptimizerTimeslot":
"""Merge with other OptimizerTimeslot.
Creates a new OptimizerTimeslot object.
Its availability is constructed by merging the availabilities of self and other,
its constraints by taking the union of both constraint sets.
As an index, the index of self is used.
"""
avail = self.avail.merge_with(other.avail)
constraints = self.constraints.union(other.constraints)
return OptimizerTimeslot(
avail=avail, idx=self.idx, constraints=constraints
)
def __repr__(self) -> str:
return f"({self.avail.simplified}, {self.idx}, {self.constraints})"
TimeslotBlock = list[OptimizerTimeslot]
def merge_blocks(
blocks: Iterable[TimeslotBlock]
) -> Iterable[TimeslotBlock]:
"""Merge iterable of blocks together.
The timeslots of all blocks are grouped into maximal blocks.
Timeslots with the same start and end are identified with each other
and merged (cf `OptimizerTimeslot.merge`).
Throws a ValueError if any timeslots are overlapping but do not
share the same start and end, i.e. partial overlap is not allowed.
:param blocks: iterable of blocks to merge.
:return: iterable of merged blocks.
:rtype: iterable over lists of OptimizerTimeslot objects
"""
if not blocks:
return []
# flatten timeslot iterables to single chain
timeslot_chain = itertools.chain.from_iterable(blocks)
# sort timeslots according to start
timeslots = sorted(
timeslot_chain,
key=lambda slot: slot.avail.start
)
if not timeslots:
return []
all_blocks = []
current_block = [timeslots[0]]
timeslots = timeslots[1:]
for slot in timeslots:
if current_block and slot.avail.overlaps(current_block[-1].avail, strict=True):
if (
slot.avail.start == current_block[-1].avail.start
and slot.avail.end == current_block[-1].avail.end
):
# the same timeslot -> merge
current_block[-1] = current_block[-1].merge(slot)
else:
# partial overlap of interiors -> not supported
raise ValueError(
"Partially overlapping timeslots are not supported!"
f" ({current_block[-1].avail.simplified}, {slot.avail.simplified})"
)
elif not current_block or slot.avail.overlaps(current_block[-1].avail, strict=False):
# only endpoints in intersection -> same block
current_block.append(slot)
else:
# no overlap at all -> new block
all_blocks.append(current_block)
current_block = [slot]
if current_block:
all_blocks.append(current_block)
return all_blocks
class Event(models.Model):
""" An event supplies the frame for all Aks.
"""
An event supplies the frame for all Aks.
"""
name = models.CharField(max_length=64, unique=True, verbose_name=_('Name'),
help_text=_('Name or iteration of the event'))
......@@ -31,7 +141,10 @@ class Event(models.Model):
help_text=_('When should AKs with intention to submit a resolution be done?'))
interest_start = models.DateTimeField(verbose_name=_('Interest Window Start'), blank=True, null=True,
help_text=_('Opening time for expression of interest.'))
help_text=
_('Opening time for expression of interest. When left blank, no interest '
'indication will be possible.'))
interest_end = models.DateTimeField(verbose_name=_('Interest Window End'), blank=True, null=True,
help_text=_('Closing time for expression of interest.'))
......@@ -42,16 +155,28 @@ class Event(models.Model):
plan_hidden = models.BooleanField(verbose_name=_('Plan Hidden'), help_text=_('Hides plan for non-staff users'),
default=True)
plan_published_at = models.DateTimeField(verbose_name=_('Plan published at'), blank=True, null=True,
help_text=_('Timestamp at which the plan was published'))
help_text=_('Timestamp at which the plan was published'))
poll_hidden = models.BooleanField(verbose_name=_('Poll Hidden'),
help_text=_('Hides preference poll for non-staff users'),
default=True)
poll_published_at = models.DateTimeField(verbose_name=_('Poll published at'), blank=True, null=True,
help_text=_('Timestamp at which the preference poll was published'))
base_url = models.URLField(verbose_name=_("Base URL"), help_text=_("Prefix for wiki link construction"), blank=True)
wiki_export_template_name = models.CharField(verbose_name=_("Wiki Export Template Name"), blank=True, max_length=50)
default_slot = models.DecimalField(max_digits=4, decimal_places=2, default=2, verbose_name=_('Default Slot Length'),
help_text=_('Default length in hours that is assumed for AKs in this event.'))
export_slot = models.DecimalField(max_digits=4, decimal_places=2, default=1, verbose_name=_('Export Slot Length'),
help_text=_(
'Slot duration in hours that is used in the timeslot discretization, '
'when this event is exported for the solver.'
))
contact_email = models.EmailField(verbose_name=_("Contact email address"), blank=True,
help_text=_(
"An email address that is displayed on every page and can be used for all kinds of questions"))
help_text=_("An email address that is displayed on every page "
"and can be used for all kinds of questions"))
class Meta:
verbose_name = _('Event')
......@@ -63,25 +188,41 @@ class Event(models.Model):
@staticmethod
def get_by_slug(slug):
"""
Get event by its slug
:param slug: slug of the event
:return: event identified by the slug
:rtype: Event
"""
return Event.objects.get(slug=slug)
@staticmethod
def get_next_active():
# Get first active event taking place
"""
Get first active event taking place
:return: matching event (if any) or None
:rtype: Event
"""
event = Event.objects.filter(active=True).order_by('start').first()
# No active event? Return the next event taking place
if event is None:
event = Event.objects.order_by('start').filter(start__gt=datetime.now()).first()
event = Event.objects.order_by('start').filter(start__gt=datetime.now().astimezone()).first()
return event
def get_categories_with_aks(self, wishes_seperately=False, filter=lambda ak: True, hide_empty_categories=False):
def get_categories_with_aks(self, wishes_seperately=False,
filter_func=lambda ak: True, hide_empty_categories=False, types=None):
"""
Get AKCategories as well as a list of AKs belonging to the category for this event
:param wishes_seperately: Return wishes as individual list.
:type wishes_seperately: bool
:param filter: Optional filter predicate, only include AK in list if filter returns True
:type filter: (AK)->bool
:param filter_func: Optional filter predicate, only include AK in list if filter returns True
:type filter_func: (AK)->bool
:param hide_empty_categories: If True, categories with no AKs will not be included in the result
:type hide_empty_categories: bool
:param types: Optional list of AK types to filter by, if None, all types are included
:type types: list[AKType] | None
:return: list of category-AK-list-tuples, optionally the additional list of AK wishes
:rtype: list[(AKCategory, list[AK])] [, list[AK]]
"""
......@@ -89,11 +230,29 @@ class Event(models.Model):
categories_with_aks = []
ak_wishes = []
# Fill lists by iterating
# A different behavior is needed depending on whether wishes should show up inside their categories
# or as a separate category
def _get_category_aks(category, types):
"""
Get all AKs belonging to a category
Use joining and prefetching to reduce the number of necessary SQL queries
:param category: category the AKs should belong to
:return: QuerySet over AKs
:return: QuerySet[AK]
"""
s = category.ak_set
if types is not None:
s = s.filter(types__in=types).distinct()
return s.select_related('event').prefetch_related('owners', 'akslot_set', 'types').all()
if wishes_seperately:
for category in categories:
ak_list = []
for ak in category.ak_set.select_related('event').prefetch_related('owners', 'akslot_set').all():
if filter(ak):
for ak in _get_category_aks(category, types):
if filter_func(ak):
if ak.wish:
ak_wishes.append(ak)
else:
......@@ -101,27 +260,302 @@ class Event(models.Model):
if not hide_empty_categories or len(ak_list) > 0:
categories_with_aks.append((category, ak_list))
return categories_with_aks, ak_wishes
else:
for category in categories:
ak_list = []
for ak in category.ak_set.all():
if filter(ak):
ak_list.append(ak)
if not hide_empty_categories or len(ak_list) > 0:
categories_with_aks.append((category, ak_list))
return categories_with_aks
for category in categories:
ak_list = []
for ak in _get_category_aks(category, types):
if filter_func(ak):
ak_list.append(ak)
if not hide_empty_categories or len(ak_list) > 0:
categories_with_aks.append((category, ak_list))
return categories_with_aks
def get_unscheduled_wish_slots(self):
"""
Get all slots of wishes that are currently not scheduled
:return: queryset of theses slots
:rtype: QuerySet[AKSlot]
"""
return self.akslot_set.filter(start__isnull=True).annotate(Count('ak__owners')).filter(ak__owners__count=0)
def get_aks_without_availabilities(self):
return self.ak_set.annotate(Count('availabilities', distinct=True)).annotate(Count('owners', distinct=True)).filter(availabilities__count=0, owners__count__gt=0)
"""
Gt all AKs that don't have any availability at all
:return: generator over these AKs
:rtype: Generator[AK]
"""
return (self.ak_set
.annotate(Count('availabilities', distinct=True))
.annotate(Count('owners', distinct=True))
.filter(availabilities__count=0, owners__count__gt=0)
)
def _generate_slots_from_block(
self,
start: datetime,
end: datetime,
slot_duration: timedelta,
*,
slot_index: int = 0,
constraints: set[str] | None = None,
) -> Generator[TimeslotBlock, None, int]:
"""Discretize a time range into timeslots.
Uses a uniform discretization into discrete slots of length `slot_duration`,
starting at `start`. No incomplete timeslots are generated, i.e.
if (`end` - `start`) is not a whole number multiple of `slot_duration`
then the last incomplete timeslot is dropped.
:param start: Start of the time range.
:param end: Start of the time range.
:param slot_duration: Duration of a single timeslot in the discretization.
:param slot_index: index of the first timeslot. Defaults to 0.
:yield: Block of optimizer timeslots as the discretization result.
:ytype: list of OptimizerTimeslot
:return: The first slot index after the yielded blocks, i.e.
`slot_index` + total # generated timeslots
:rtype: int
"""
# local import to prevent cyclic import
# pylint: disable=import-outside-toplevel
from AKModel.availability.models import Availability
current_slot_start = start
previous_slot_start: datetime | None = None
if constraints is None:
constraints = set()
current_block = []
room_availabilities = list({
availability
for room in Room.objects.filter(event=self)
for availability in room.availabilities.all()
})
while current_slot_start + slot_duration <= end:
slot = Availability(
event=self,
start=current_slot_start,
end=current_slot_start + slot_duration,
)
if any((availability.contains(slot) for availability in room_availabilities)):
# no gap in a block
if (
previous_slot_start is not None
and previous_slot_start + slot_duration < current_slot_start
):
yield current_block
current_block = []
current_block.append(
OptimizerTimeslot(avail=slot, idx=slot_index, constraints=constraints)
)
previous_slot_start = current_slot_start
slot_index += 1
current_slot_start += slot_duration
if current_block:
yield current_block
return slot_index
def uniform_time_slots(self, *, slots_in_an_hour: float) -> Iterable[TimeslotBlock]:
"""Uniformly discretize the entire event into blocks of timeslots.
Discretizes entire event uniformly. May not necessarily result in a single block
as slots with no room availability are dropped.
:param slots_in_an_hour: The percentage of an hour covered by a single slot.
Determines the discretization granularity.
:yield: Block of optimizer timeslots as the discretization result.
:ytype: list of OptimizerTimeslot
"""
all_category_constraints = AKCategory.create_category_optimizer_constraints(
AKCategory.objects.filter(event=self).all()
)
yield from self._generate_slots_from_block(
start=self.start,
end=self.end,
slot_duration=timedelta(hours=1.0 / slots_in_an_hour),
constraints=all_category_constraints,
)
def default_time_slots(self, *, slots_in_an_hour: float) -> Iterable[TimeslotBlock]:
"""Discretize all default slots into blocks of timeslots.
In the discretization each default slot corresponds to one block.
:param slots_in_an_hour: The percentage of an hour covered by a single slot.
Determines the discretization granularity.
:yield: Block of optimizer timeslots as the discretization result.
:ytype: list of TimeslotBlock
"""
slot_duration = timedelta(hours=1.0 / slots_in_an_hour)
slot_index = 0
for block_slot in DefaultSlot.objects.filter(event=self).order_by("start", "end"):
category_constraints = AKCategory.create_category_optimizer_constraints(
block_slot.primary_categories.all()
)
slot_index = yield from self._generate_slots_from_block(
start=block_slot.start,
end=block_slot.end,
slot_duration=slot_duration,
slot_index=slot_index,
constraints=category_constraints,
)
def discretize_timeslots(self, *, slots_in_an_hour: float | None = None) -> Iterable[TimeslotBlock]:
""""Choose discretization scheme.
Uses default_time_slots if the event has any DefaultSlot, otherwise uniform_time_slots.
:param slots_in_an_hour: The percentage of an hour covered by a single slot.
Determines the discretization granularity.
:yield: Block of optimizer timeslots as the discretization result.
:ytype: list of TimeslotBlock
"""
if slots_in_an_hour is None:
slots_in_an_hour = 1.0 / float(self.export_slot)
if DefaultSlot.objects.filter(event=self).exists():
# discretize default slots if they exists
yield from merge_blocks(self.default_time_slots(slots_in_an_hour=slots_in_an_hour))
else:
yield from self.uniform_time_slots(slots_in_an_hour=slots_in_an_hour)
@transaction.atomic
def schedule_from_json(
self, schedule: str | dict[str, Any], *, check_for_data_inconsistency: bool = True
) -> int:
"""Load AK schedule from a json string.
:param schedule: A string that can be decoded to json, describing
the AK schedule. The json data is assumed to be constructed
following the output specification of the KoMa conference optimizer, cf.
https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format
"""
if isinstance(schedule, str):
schedule = json.loads(schedule)
if "input" not in schedule or "scheduled_aks" not in schedule:
raise ValueError(_("Cannot parse malformed JSON input."))
if apps.is_installed("AKSolverInterface") and check_for_data_inconsistency:
from AKSolverInterface.serializers import ExportEventSerializer # pylint: disable=import-outside-toplevel
export_dict = ExportEventSerializer(self).data
if schedule["input"] != export_dict:
raise ValueError(_("Data has changed since the export. Reexport and run the solver again."))
slots_in_an_hour = schedule["input"]["timeslots"]["info"]["duration"]
timeslot_dict = {
timeslot.idx: timeslot
for block in self.discretize_timeslots(slots_in_an_hour=slots_in_an_hour)
for timeslot in block
}
slots_updated = 0
for scheduled_slot in schedule["scheduled_aks"]:
scheduled_slot["timeslot_ids"] = list(map(int, scheduled_slot["timeslot_ids"]))
slot = AKSlot.objects.get(id=int(scheduled_slot["ak_id"]))
if not scheduled_slot["timeslot_ids"]:
raise ValueError(
_("AK {ak_name} is not assigned any timeslot by the solver").format(ak_name=slot.ak.name)
)
start_timeslot = timeslot_dict[min(scheduled_slot["timeslot_ids"])].avail
end_timeslot = timeslot_dict[max(scheduled_slot["timeslot_ids"])].avail
solver_duration = (end_timeslot.end - start_timeslot.start).total_seconds() / 3600.0
if solver_duration + 2e-4 < slot.duration:
raise ValueError(
_(
"Duration of AK {ak_name} assigned by solver ({solver_duration} hours) "
"is less than the duration required by the slot ({slot_duration} hours)"
).format(
ak_name=slot.ak.name,
solver_duration=solver_duration,
slot_duration=slot.duration,
)
)
if slot.fixed:
solver_room = Room.objects.get(id=int(scheduled_slot["room_id"]))
if slot.room != solver_room:
raise ValueError(
_(
"Fixed AK {ak_name} assigned by solver to room {solver_room} "
"is fixed to room {slot_room}"
).format(
ak_name=slot.ak.name,
solver_room=solver_room.name,
slot_room=slot.room.name,
)
)
if slot.start != start_timeslot.start:
raise ValueError(
_(
"Fixed AK {ak_name} assigned by solver to start at {solver_start} "
"is fixed to start at {slot_start}"
).format(
ak_name=slot.ak.name,
solver_start=start_timeslot.start,
slot_start=slot.start,
)
)
else:
slot.room = Room.objects.get(id=int(scheduled_slot["room_id"]))
slot.start = start_timeslot.start
slot.save()
slots_updated += 1
return slots_updated
@property
def rooms(self):
"""Ordered queryset of all rooms associated to this event."""
return Room.objects.filter(event=self).order_by()
@property
def slots(self):
"""Ordered queryset of all AKSlots associated to this event."""
return AKSlot.objects.filter(event=self).order_by()
@property
def participants(self):
"""Ordered queryset of all participants associated to this event."""
if apps.is_installed("AKPreference"):
# local import to prevent cyclic import
# pylint: disable=import-outside-toplevel
from AKPreference.models import EventParticipant
return EventParticipant.objects.filter(event=self).order_by()
return []
@property
def owners(self):
"""Ordered queryset of all AK owners associated to this event."""
return AKOwner.objects.filter(event=self).order_by()
class AKOwner(models.Model):
""" An AKOwner describes the person organizing/holding an AK.
"""
name = models.CharField(max_length=64, verbose_name=_('Nickname'), help_text=_('Name to identify an AK owner by'))
name = models.CharField(max_length=64, verbose_name=_('Nickname'),
validators=[no_quotation_marks_validator, slugable_validator],
help_text=_('Name to identify an AK owner by'))
slug = models.SlugField(max_length=64, blank=True, verbose_name=_('Slug'), help_text=_('Slug for URL generation'))
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'))
......@@ -141,21 +575,34 @@ class AKOwner(models.Model):
return self.name
def _generate_slug(self):
"""
Auto-generate a slug for an owner
This will start with a very simple slug (the name truncated to a maximum length) and then gradually produce
more complicated slugs when the previous candidates are already used
:return: the slug
:rtype: str
"""
max_length = self._meta.get_field('slug').max_length
# Try name alone (truncated if necessary)
slug_candidate = slugify(self.name)[:max_length]
if not AKOwner.objects.filter(event=self.event, slug=slug_candidate).exists():
self.slug = slug_candidate
return
# Try name and institution separated by '_' (truncated if necessary)
slug_candidate = slugify(slug_candidate + '_' + self.institution)[:max_length]
if not AKOwner.objects.filter(event=self.event, slug=slug_candidate).exists():
self.slug = slug_candidate
return
# Try name + institution + an incrementing digit
for i in itertools.count(1):
if not AKOwner.objects.filter(event=self.event, slug=slug_candidate).exists():
break
digits = len(str(i))
slug_candidate = '{}-{}'.format(slug_candidate[:-(digits + 1)], i)
slug_candidate = f'{slug_candidate[:-(digits + 1)]}-{i}'
self.slug = slug_candidate
......@@ -167,6 +614,15 @@ class AKOwner(models.Model):
@staticmethod
def get_by_slug(event, slug):
"""
Get owner by slug
Will be identified by the combination of event slug and owner slug which is unique
:param event: event
:param slug: slug of the owner
:return: owner identified by slugs
:rtype: AKOwner
"""
return AKOwner.objects.get(event=event, slug=slug)
......@@ -178,8 +634,8 @@ class AKCategory(models.Model):
description = models.TextField(blank=True, verbose_name=_("Description"),
help_text=_("Short description of this AK Category"))
present_by_default = models.BooleanField(blank=True, default=True, verbose_name=_("Present by default"),
help_text=_(
"Present AKs of this category by default if AK owner did not specify whether this AK should be presented?"))
help_text=_("Present AKs of this category by default if AK owner did not "
"specify whether this AK should be presented?"))
event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
help_text=_('Associated event'))
......@@ -193,6 +649,20 @@ class AKCategory(models.Model):
def __str__(self):
return self.name
@staticmethod
def create_category_optimizer_constraints(categories: Iterable["AKCategory"]) -> set[str]:
"""Create a set of constraint strings from an AKCategory iterable.
:param categories: The iterable of categories to derive the constraint strings from.
:return: A set of category constraint strings, i.e. strings of the form
'availability-cat-<cat.name>'.
:rtype: set of strings.
"""
return {
f"availability-cat-{cat.name}"
for cat in categories
}
class AKTrack(models.Model):
""" An AKTrack describes a set of semantically related AKs.
......@@ -213,6 +683,11 @@ class AKTrack(models.Model):
return self.name
def aks_with_category(self):
"""
Get all AKs that belong to this track with category already joined to prevent additional SQL queries
:return: queryset over the AKs
:rtype: QuerySet[AK]
"""
return self.ak_set.select_related('category').all()
......@@ -234,23 +709,46 @@ class AKRequirement(models.Model):
return self.name
class AKType(models.Model):
""" An AKType allows to associate one or multiple types with an AK, e.g., to better describe the format of that AK
or to which group of people it is addressed. Types are specified per event and are an optional feature.
"""
name = models.CharField(max_length=128, verbose_name=_('Name'), help_text=_('Name describing the type'))
slug = models.SlugField(max_length=30, blank=False, verbose_name=_('Slug'),)
event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
help_text=_('Associated event'))
class Meta:
verbose_name = _('AK Type')
verbose_name_plural = _('AK Types')
ordering = ['name']
unique_together = [['event', 'name'], ['event', 'slug']]
def __str__(self):
return self.name
class AK(models.Model):
""" An AK is a slot-based activity to be scheduled during an event.
"""
name = models.CharField(max_length=256, verbose_name=_('Name'), help_text=_('Name of the AK'))
name = models.CharField(max_length=256, verbose_name=_('Name'), help_text=_('Name of the AK'),
validators=[no_quotation_marks_validator, slugable_validator])
short_name = models.CharField(max_length=64, blank=True, verbose_name=_('Short Name'),
validators=[no_quotation_marks_validator],
help_text=_('Name displayed in the schedule'))
description = models.TextField(blank=True, verbose_name=_('Description'), help_text=_('Description of the AK'))
owners = models.ManyToManyField(to=AKOwner, blank=True, verbose_name=_('Owners'),
help_text=_('Those organizing the AK'))
# TODO generate automatically
# Will be automatically generated in save method if not set
link = models.URLField(blank=True, verbose_name=_('Web Link'), help_text=_('Link to wiki page'))
protocol_link = models.URLField(blank=True, verbose_name=_('Protocol Link'), help_text=_('Link to protocol'))
category = models.ForeignKey(to=AKCategory, on_delete=models.PROTECT, verbose_name=_('Category'),
help_text=_('Category of the AK'))
types = models.ManyToManyField(to=AKType, blank=True, verbose_name=_('Types'),
help_text=_("This AK is"))
track = models.ForeignKey(to=AKTrack, blank=True, on_delete=models.SET_NULL, null=True, verbose_name=_('Track'),
help_text=_('Track the AK belongs to'))
......@@ -268,7 +766,8 @@ class AK(models.Model):
help_text=_('AKs that should precede this AK in the schedule'))
notes = models.TextField(blank=True, verbose_name=_('Organizational Notes'), help_text=_(
'Notes to organizers. These are public. For private notes, please use the button for private messages on the detail page of this AK (after creation/editing).'))
'Notes to organizers. These are public. For private notes, please use the button for private messages '
'on the detail page of this AK (after creation/editing).'))
interest = models.IntegerField(default=-1, verbose_name=_('Interest'), help_text=_('Expected number of people'))
interest_counter = models.IntegerField(default=0, verbose_name=_('Interest Counter'),
......@@ -280,12 +779,13 @@ class AK(models.Model):
include_in_export = models.BooleanField(default=True, verbose_name=_('Export?'),
help_text=_("Include AK in wiki export?"))
history = HistoricalRecords(excluded_fields=['interest_counter', 'include_in_export'])
history = HistoricalRecords(excluded_fields=['interest', 'interest_counter', 'include_in_export'])
class Meta:
verbose_name = _('AK')
verbose_name_plural = _('AKs')
unique_together = [['event', 'name'], ['event', 'short_name']]
ordering = ['pk']
def __str__(self):
if self.short_name:
......@@ -294,51 +794,142 @@ class AK(models.Model):
@property
def details(self):
"""
Generate a detailed string representation, e.g., for usage in scheduling
:return: string representation of that AK with all details
:rtype: str
"""
# local import to prevent cyclic import
# pylint: disable=import-outside-toplevel
from AKModel.availability.models import Availability
availabilities = ', \n'.join(f'{a.simplified}' for a in Availability.objects.select_related('event').filter(ak=self))
return f"""{self.name}{" (R)" if self.reso else ""}:
availabilities = ', \n'.join(f'{a.simplified}' for a in Availability.objects.select_related('event')
.filter(ak=self))
detail_string = f"""{self.name}{" (R)" if self.reso else ""}:
{self.owners_list}
{_("Requirements")}: {", ".join(str(r) for r in self.requirements.all())}
{_("Conflicts")}: {", ".join(str(c) for c in self.conflicts.all())}
{_("Prerequisites")}: {", ".join(str(p) for p in self.prerequisites.all())}
{_("Availabilities")}: \n{availabilities}"""
{_('Interest')}: {self.interest}"""
if self.requirements.count() > 0:
detail_string += f"\n{_('Requirements')}: {', '.join(str(r) for r in self.requirements.all())}"
if self.types.count() > 0:
detail_string += f"\n{_('Types')}: {', '.join(str(r) for r in self.types.all())}"
# Find conflicts
# (both directions, those specified for this AK and those were this AK was specified as conflict)
# Deduplicate and order list alphabetically
conflicts = set()
if self.conflicts.count() > 0:
for c in self.conflicts.all():
conflicts.add(str(c))
if self.conflict.count() > 0:
for c in self.conflict.all():
conflicts.add(str(c))
if len(conflicts) > 0:
conflicts = list(conflicts)
conflicts.sort()
detail_string += f"\n{_('Conflicts')}: {', '.join(conflicts)}"
if self.prerequisites.count() > 0:
detail_string += f"\n{_('Prerequisites')}: {', '.join(str(p) for p in self.prerequisites.all())}"
detail_string += f"\n{_('Availabilities')}: \n{availabilities}"
return detail_string
@property
def owners_list(self):
"""
Get a stringified list of stringified representations of all owners
:return: stringified list of owners
:rtype: str
"""
return ", ".join(str(owner) for owner in self.owners.all())
@property
def durations_list(self):
"""
Get a stringified list of stringified representations of all durations of associated slots
:return: stringified list of durations
:rtype: str
"""
return ", ".join(str(slot.duration_simplified) for slot in self.akslot_set.select_related('event').all())
@property
def types_list(self):
"""
Get a stringified list of all types of this AK
:return: stringified list of types
:rtype: str
"""
return ", ".join(str(t) for t in self.types.all())
@property
def wish(self):
"""
Is the AK a wish?
:return: true if wish, false if not
:rtype: bool
"""
return self.owners.count() == 0
def increment_interest(self):
"""
Increment the interest counter for this AK by one
without tracking that change to prevent an unreadable and large history
"""
self.interest_counter += 1
self.skip_history_when_saving = True
self.skip_history_when_saving = True # pylint: disable=attribute-defined-outside-init
self.save()
del self.skip_history_when_saving
@property
def availabilities(self):
"""
Get all availabilities associated to this AK
:return: availabilities
:rtype: QuerySet[Availability]
"""
return "Availability".objects.filter(ak=self)
@property
def edit_url(self):
"""
Get edit URL for this AK
Will link to frontend if AKSubmission is active, otherwise to the edit view for this object in admin interface
:return: URL
:rtype: str
"""
if apps.is_installed("AKSubmission"):
return reverse_lazy('submit:ak_edit', kwargs={'event_slug': self.event.slug, 'pk': self.id})
return reverse_lazy('admin:AKModel_ak_change', kwargs={'object_id': self.id})
@property
def detail_url(self):
"""
Get detail URL for this AK
Will link to frontend if AKSubmission is active, otherwise to the edit view for this object in admin interface
:return: URL
:rtype: str
"""
if apps.is_installed("AKSubmission"):
return reverse_lazy('submit:ak_detail', kwargs={'event_slug': self.event.slug, 'pk': self.id})
return self.edit_url
def save(self, *args, force_insert=False, force_update=False, using=None, update_fields=None):
# Auto-Generate Link if not set yet
if self.link == "":
link = self.event.base_url + self.name.replace(" ", "_")
# Truncate links longer than 200 characters (default length of URL fields in django)
self.link = link[:200]
# Tell Django that we have updated the link field
if update_fields is not None:
update_fields = {"link"}.union(update_fields)
super().save(*args,
force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields)
class Room(models.Model):
""" A room describes where an AK can be held.
......@@ -362,6 +953,12 @@ class Room(models.Model):
@property
def title(self):
"""
Get title of a room, which consists of location and name if location is set, otherwise only the name
:return: title
:rtype: str
"""
if self.location:
return f"{self.location} {self.name}"
return self.name
......@@ -369,6 +966,32 @@ class Room(models.Model):
def __str__(self):
return self.title
def get_time_constraints(self) -> list[str]:
"""Construct list of required time constraint labels."""
# local import to prevent cyclic import
# pylint: disable=import-outside-toplevel
from AKModel.availability.models import Availability
# check if room is available for the whole event
# -> no time constraint needs to be introduced
if Availability.is_event_covered(self.event, self.availabilities.all()):
time_constraints = []
else:
time_constraints = [f"availability-room-{self.pk}"]
return time_constraints
def get_fulfilled_room_constraints(self) -> list[str]:
"""Construct list of fulfilled room constraint labels."""
fulfilled_room_constraints = list(self.properties.values_list("name", flat=True))
fulfilled_room_constraints.append(f"fixed-room-{self.pk}")
if not any(constr.startswith("proxy") for constr in fulfilled_room_constraints):
fulfilled_room_constraints.append("no-proxy")
fulfilled_room_constraints.sort()
return fulfilled_room_constraints
class AKSlot(models.Model):
""" An AK Mapping matches an AK to a room during a certain time.
......@@ -427,7 +1050,8 @@ class AKSlot(models.Model):
start = self.start.astimezone(self.event.timezone)
end = self.end.astimezone(self.event.timezone)
return f"{start.strftime('%a %H:%M')} - {end.strftime('%H:%M') if start.day == end.day else end.strftime('%a %H:%M')}"
return (f"{start.strftime('%a %H:%M')} - "
f"{end.strftime('%H:%M') if start.day == end.day else end.strftime('%a %H:%M')}")
@property
def end(self):
......@@ -446,10 +1070,103 @@ class AKSlot(models.Model):
return (timezone.now() - self.updated).total_seconds()
def overlaps(self, other: "AKSlot"):
"""
Check whether two slots overlap
:param other: second slot to compare with
:return: true if they overlap, false if not:
:rtype: bool
"""
return self.start < other.end <= self.end or self.start <= other.start < self.end
def save(self, *args, force_insert=False, force_update=False, using=None, update_fields=None):
# Make sure duration is not longer than the event
if update_fields is None or 'duration' in update_fields:
event_duration = self.event.end - self.event.start
event_duration_hours = event_duration.days * 24 + event_duration.seconds // 3600
self.duration = min(self.duration, event_duration_hours)
super().save(*args,
force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields)
def get_room_constraints(self) -> list[str]:
"""Construct list of required room constraint labels."""
room_constraints = list(self.ak.requirements.values_list("name", flat=True).order_by())
if self.fixed and self.room is not None:
room_constraints.append(f"fixed-room-{self.room.pk}")
if not any(constr.startswith("proxy") for constr in room_constraints):
room_constraints.append("no-proxy")
room_constraints.sort()
return room_constraints
def get_time_constraints(self) -> list[str]:
"""Construct list of required time constraint labels."""
# local import to prevent cyclic import
# pylint: disable=import-outside-toplevel
from AKModel.availability.models import Availability
def _owner_time_constraints(owner: AKOwner):
owner_avails = owner.availabilities.all()
if not owner_avails or Availability.is_event_covered(self.event, owner_avails):
return []
return [f"availability-person-{owner.pk}"]
# check if ak resp. owner is available for the whole event
# -> no time constraint needs to be introduced
if self.fixed and self.start is not None:
time_constraints = [f"fixed-akslot-{self.id}"]
elif not Availability.is_event_covered(self.event, self.ak.availabilities.all()):
time_constraints = [f"availability-ak-{self.ak.pk}"]
else:
time_constraints = []
if self.ak.reso:
time_constraints.append("resolution")
for owner in self.ak.owners.all():
time_constraints.extend(_owner_time_constraints(owner))
if self.ak.category:
category_constraints = AKCategory.create_category_optimizer_constraints([self.ak.category])
time_constraints.extend(category_constraints)
time_constraints.sort()
return time_constraints
@property
def export_duration(self) -> int:
"""Number of discrete export timeslots covered by this AKSlot."""
export_duration = self.duration / self.event.export_slot
# We need to return an int, so we round up.
# If the exact result for `export_duration` is an integer `k`,
# FLOP inaccuracies could yield `k + eps`. Then, rounding up
# would return `k + 1` instead of `k`. To avoid this, we subtract
# a small epsilon before rounding.
return math.ceil(export_duration - settings.EXPORT_CEIL_OFFSET_EPS)
@property
def type_names(self):
"""Ordered queryset of the names of all types of this slot's AK."""
return self.ak.types.values_list("name", flat=True).order_by()
@property
def conflict_pks(self) -> list[int]:
"""Ordered queryset of the PKs of all AKSlots that in conflict to this slot."""
conflict_slots = AKSlot.objects.filter(ak__in=self.ak.conflicts.all())
other_ak_slots = AKSlot.objects.filter(ak=self.ak).exclude(pk=self.pk)
return list((conflict_slots | other_ak_slots).values_list("pk", flat=True).order_by())
@property
def depencency_pks(self) -> list[int]:
"""Ordered queryset of the PKs of all AKSlots that this slot depends on."""
dependency_slots = AKSlot.objects.filter(ak__in=self.ak.prerequisites.all())
return list(dependency_slots.values_list("pk", flat=True).order_by())
class AKOrgaMessage(models.Model):
"""
Model representing confidential messages to the organizers/scheduling people, belonging to a certain AK
"""
ak = models.ForeignKey(to=AK, on_delete=models.CASCADE, verbose_name=_('AK'),
help_text=_('AK this message belongs to'))
text = models.TextField(verbose_name=_("Message text"),
......@@ -457,6 +1174,8 @@ class AKOrgaMessage(models.Model):
timestamp = models.DateTimeField(auto_now_add=True)
event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
help_text=_('Associated event'))
resolved = models.BooleanField(verbose_name=_('Resolved'), default=False,
help_text=_('This message has been resolved (no further action needed)'))
class Meta:
verbose_name = _('AK Orga Message')
......@@ -468,12 +1187,24 @@ class AKOrgaMessage(models.Model):
class ConstraintViolation(models.Model):
"""
Model to represent any kind of constraint violation
Can have two different severities: violation and warning
The list of possible types is defined in :class:`ViolationType`
Depending on the type, different fields (references to other models) will be filled. Each violation should always
be related to an event and at least on other instance of a causing entity
"""
class Meta:
verbose_name = _('Constraint Violation')
verbose_name_plural = _('Constraint Violations')
ordering = ['-timestamp']
class ViolationType(models.TextChoices):
"""
Possible types of violations with their text representation
"""
OWNER_TWO_SLOTS = 'ots', _('Owner has two parallel slots')
SLOT_OUTSIDE_AVAIL = 'soa', _('AK Slot was scheduled outside the AK\'s availabilities')
ROOM_TWO_SLOTS = 'rts', _('Room has two AK slots scheduled at the same time')
......@@ -481,13 +1212,16 @@ class ConstraintViolation(models.Model):
AK_CONFLICT_COLLISION = 'acc', _('AK Slot is scheduled at the same time as an AK listed as a conflict')
AK_BEFORE_PREREQUISITE = 'abp', _('AK Slot is scheduled before an AK listed as a prerequisite')
AK_AFTER_RESODEADLINE = 'aar', _(
'AK Slot for AK with intention to submit a resolution is scheduled after resolution deadline')
'AK Slot for AK with intention to submit a resolution is scheduled after resolution deadline')
AK_CATEGORY_MISMATCH = 'acm', _('AK Slot in a category is outside that categories availabilities')
AK_SLOT_COLLISION = 'asc', _('Two AK Slots for the same AK scheduled at the same time')
ROOM_CAPACITY_EXCEEDED = 'rce', _('Room does not have enough space for interest in scheduled AK Slot')
SLOT_OUTSIDE_EVENT = 'soe', _('AK Slot is scheduled outside the event\'s availabilities')
class ViolationLevel(models.IntegerChoices):
"""
Possible severities/levels of a CV
"""
WARNING = 1, _('Warning')
VIOLATION = 10, _('Violation')
......@@ -499,6 +1233,7 @@ class ConstraintViolation(models.Model):
event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
help_text=_('Associated event'))
# Possible "causes":
aks = models.ManyToManyField(to=AK, blank=True, verbose_name=_('AKs'),
help_text=_('AK(s) belonging to this constraint'))
ak_slots = models.ManyToManyField(to=AKSlot, blank=True, verbose_name=_('AK Slots'),
......@@ -549,22 +1284,37 @@ class ConstraintViolation(models.Model):
@property
def details(self):
"""
Property: Details
"""
return self.get_details()
@property
def edit_url(self):
def edit_url(self) -> str:
"""
Property: Edit URL for this CV
"""
return reverse_lazy('admin:AKModel_constraintviolation_change', kwargs={'object_id': self.pk})
@property
def level_display(self):
def level_display(self) -> str:
"""
Property: Severity as string
"""
return self.get_level_display()
@property
def type_display(self):
def type_display(self) -> str:
"""
Property: Type as string
"""
return self.get_type_display()
@property
def timestamp_display(self):
def timestamp_display(self) -> str:
"""
Property: Creation timestamp as string
"""
return self.timestamp.astimezone(self.event.timezone).strftime('%d.%m.%y %H:%M')
@property
......@@ -583,7 +1333,10 @@ class ConstraintViolation(models.Model):
return self.aks_tmp
@property
def _aks_str(self):
def _aks_str(self) -> str:
"""
Property: AKs as string
"""
if self.pk and self.pk > 0:
return ', '.join(str(a) for a in self.aks.all())
return ', '.join(str(a) for a in self.aks_tmp)
......@@ -604,7 +1357,10 @@ class ConstraintViolation(models.Model):
return self.ak_slots_tmp
@property
def _ak_slots_str(self):
def _ak_slots_str(self) -> str:
"""
Property: Slots as string
"""
if self.pk and self.pk > 0:
return ', '.join(str(a) for a in self.ak_slots.select_related('event').all())
return ', '.join(str(a) for a in self.ak_slots_tmp)
......@@ -653,6 +1409,11 @@ class ConstraintViolation(models.Model):
class DefaultSlot(models.Model):
"""
Model representing a default slot,
i.e., a prefered slot to use for typical AKs in the schedule to guarantee enough breaks etc.
"""
class Meta:
verbose_name = _('Default Slot')
verbose_name_plural = _('Default Slots')
......@@ -665,22 +1426,35 @@ class DefaultSlot(models.Model):
help_text=_('Associated event'))
primary_categories = models.ManyToManyField(to=AKCategory, verbose_name=_('Primary categories'), blank=True,
help_text=_('Categories that should be assigned to this slot primarily'))
help_text=_(
'Categories that should be assigned to this slot primarily'))
@property
def start_simplified(self):
def start_simplified(self) -> str:
"""
Property: Simplified version of the start timetstamp (weekday, hour, minute) as string
"""
return self.start.astimezone(self.event.timezone).strftime('%a %H:%M')
@property
def start_iso(self):
def start_iso(self) -> str:
"""
Property: Start timestamp as ISO timestamp for usage in calendar views
"""
return timezone.localtime(self.start, self.event.timezone).strftime("%Y-%m-%dT%H:%M:%S")
@property
def end_simplified(self):
def end_simplified(self) -> str:
"""
Property: Simplified version of the end timetstamp (weekday, hour, minute) as string
"""
return self.end.astimezone(self.event.timezone).strftime('%a %H:%M')
@property
def end_iso(self):
def end_iso(self) -> str:
"""
Property: End timestamp as ISO timestamp for usage in calendar views
"""
return timezone.localtime(self.end, self.event.timezone).strftime("%Y-%m-%dT%H:%M:%S")
def __str__(self):
......