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

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
Show changes
Commits on Source (26)
Showing with 691 additions and 240 deletions
image: python:3.9 image: python:3.10
services: services:
- mysql - mysql
......
...@@ -247,7 +247,14 @@ class Availability(models.Model): ...@@ -247,7 +247,14 @@ class Availability(models.Model):
f'{self.end.astimezone(self.event.timezone).strftime("%a %H:%M")}') f'{self.end.astimezone(self.event.timezone).strftime("%a %H:%M")}')
@classmethod @classmethod
def with_event_length(cls, event, person=None, room=None, ak=None, ak_category=None): def with_event_length(
cls,
event: Event,
person: AKOwner | None = None,
room: Room | None = None,
ak: AK | None = None,
ak_category: AKCategory | None = None,
) -> "Availability":
""" """
Create an availability covering exactly the time between event start and event end. Create an availability covering exactly the time between event start and event end.
Can e.g., be used to create default availabilities. Can e.g., be used to create default availabilities.
...@@ -267,6 +274,21 @@ class Availability(models.Model): ...@@ -267,6 +274,21 @@ class Availability(models.Model):
return Availability(start=timeframe_start, end=timeframe_end, event=event, person=person, return Availability(start=timeframe_start, end=timeframe_end, event=event, person=person,
room=room, ak=ak, ak_category=ak_category) room=room, ak=ak, ak_category=ak_category)
@classmethod
def is_event_covered(cls, event: Event, availabilities: List['Availability']) -> bool:
"""Check if list of availibilities cover whole event.
:param event: event to check.
:param availabilities: availabilities to check.
:return: whether the availabilities cover full event.
:rtype: bool
"""
# NOTE: Cannot use `Availability.with_event_length` as its end is the
# event end + 1 day
full_event = Availability(event=event, start=event.start, end=event.end)
avail_union = Availability.union(availabilities)
return not avail_union or avail_union[0].contains(full_event)
class Meta: class Meta:
verbose_name = _('Availability') verbose_name = _('Availability')
verbose_name_plural = _('Availabilities') verbose_name_plural = _('Availabilities')
......
...@@ -272,3 +272,13 @@ class RoomFormWithAvailabilities(AvailabilitiesFormMixin, RoomForm): ...@@ -272,3 +272,13 @@ class RoomFormWithAvailabilities(AvailabilitiesFormMixin, RoomForm):
# Filter possible values for m2m when event is specified # Filter possible values for m2m when event is specified
if hasattr(self.instance, "event") and self.instance.event is not None: if hasattr(self.instance, "event") and self.instance.event is not None:
self.fields["properties"].queryset = AKRequirement.objects.filter(event=self.instance.event) self.fields["properties"].queryset = AKRequirement.objects.filter(event=self.instance.event)
class JSONImportForm(AdminIntermediateForm):
"""Form to import an AK schedule from a json file."""
json_data = forms.CharField(
required=True,
widget=forms.Textarea,
label=_("JSON data"),
help_text=_("JSON data from the scheduling solver"),
)
import itertools import itertools
from datetime import timedelta import json
from datetime import datetime, timedelta
from typing import Iterable
from django.db import models from django.db import models
from django.apps import apps from django.apps import apps
from django.db.models import Count from django.db.models import Count
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils import timezone from django.utils import timezone
from django.utils.datetime_safe import datetime
from django.utils.text import slugify from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from simple_history.models import HistoricalRecords from simple_history.models import HistoricalRecords
...@@ -162,6 +163,135 @@ class Event(models.Model): ...@@ -162,6 +163,135 @@ class Event(models.Model):
.filter(availabilities__count=0, owners__count__gt=0) .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
) -> Iterable[list[int, "Availability"]]:
"""Discretize a time range into timeslots.
Uses a uniform discretization into blocks 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 tuples, each consisisting of the timeslot id
and its availability to indicate its start and duration.
"""
# 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
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((slot_index, slot))
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=1.0) -> Iterable[list[int, "Availability"]]:
"""Uniformly discretize the entire event into a single block of timeslots.
: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: a single list of tuples, each consisisting of the timeslot id
and its availability to indicate its start and duration.
"""
yield from self._generate_slots_from_block(
start=self.start,
end=self.end,
slot_duration=timedelta(hours=1.0 / slots_in_an_hour),
)
def default_time_slots(self, *, slots_in_an_hour=1.0) -> Iterable[list[int, "Availability"]]:
"""Discretize the all default slots into a 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 tuples, each consisisting of the timeslot id
and its availability to indicate its start and duration.
"""
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"):
# NOTE: We do not differentiate between different primary categories
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,
)
def schedule_from_json(self, schedule: str) -> None:
"""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
"""
schedule = json.loads(schedule)
slots_in_an_hour = schedule["input"]["timeslots"]["info"]["duration"]
timeslot_dict = {
slot_idx: slot
for block in self.default_time_slots(slots_in_an_hour=slots_in_an_hour)
for slot_idx, slot in block
}
for scheduled_slot in schedule["scheduled_aks"]:
slot = AKSlot.objects.get(id=int(scheduled_slot["ak_id"]))
slot.room = Room.objects.get(id=int(scheduled_slot["room_id"]))
scheduled_slot["timeslot_ids"] = list(map(int, scheduled_slot["timeslot_ids"]))
start_timeslot = timeslot_dict[min(scheduled_slot["timeslot_ids"])]
end_timeslot = timeslot_dict[max(scheduled_slot["timeslot_ids"])]
slot.start = start_timeslot.start
slot.duration = (end_timeslot.end - start_timeslot.start).total_seconds() / 3600.0
slot.save()
class AKOwner(models.Model): class AKOwner(models.Model):
""" An AKOwner describes the person organizing/holding an AK. """ An AKOwner describes the person organizing/holding an AK.
...@@ -513,6 +643,43 @@ class Room(models.Model): ...@@ -513,6 +643,43 @@ class Room(models.Model):
def __str__(self): def __str__(self):
return self.title return self.title
def as_json(self) -> str:
"""Return a json string representation of this room object.
:return: The json string representation is constructed
following the input specification of the KoMa conference optimizer, cf.
https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format
:rtype: str
"""
# 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}"]
data = {
"id": str(self.pk),
"info": {
"name": self.name,
},
"capacity": self.capacity,
"fulfilled_room_constraints": [constraint.name
for constraint in self.properties.all()],
"time_constraints": time_constraints
}
data["fulfilled_room_constraints"].append(f"availability-room-{self.pk}")
if not any(constr.startswith("proxy") for constr in data["fulfilled_room_constraints"]):
data["fulfilled_room_constraints"].append("no-proxy")
return json.dumps(data)
class AKSlot(models.Model): class AKSlot(models.Model):
""" An AK Mapping matches an AK to a room during a certain time. """ An AK Mapping matches an AK to a room during a certain time.
...@@ -608,6 +775,59 @@ class AKSlot(models.Model): ...@@ -608,6 +775,59 @@ class AKSlot(models.Model):
self.duration = min(self.duration, event_duration_hours) self.duration = min(self.duration, event_duration_hours)
super().save(force_insert, force_update, using, update_fields) super().save(force_insert, force_update, using, update_fields)
def as_json(self) -> str:
"""Return a json string representation of the AK object of this slot.
:return: The json string representation is constructed
following the input specification of the KoMa conference optimizer, cf.
https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format
:rtype: str
"""
# local import to prevent cyclic import
# pylint: disable=import-outside-toplevel
from AKModel.availability.models import Availability
# check if ak resp. owner is available for the whole event
# -> no time constraint needs to be introduced
if not self.fixed and Availability.is_event_covered(self.event, self.ak.availabilities.all()):
ak_time_constraints = []
else:
ak_time_constraints = [f"availability-ak-{self.ak.pk}"]
def _owner_time_constraints(owner: AKOwner):
if Availability.is_event_covered(self.event, owner.availabilities.all()):
return []
return [f"availability-person-{owner.pk}"]
# self.slots_in_an_hour is set in AKJSONExportView
data = {
"id": str(self.pk),
"duration": int(self.duration * self.slots_in_an_hour),
"properties": {},
"room_constraints": [constraint.name
for constraint in self.ak.requirements.all()],
"time_constraints": ["resolution"] if self.ak.reso else [],
"info": {
"name": self.ak.name,
"head": ", ".join([str(owner)
for owner in self.ak.owners.all()]),
"description": self.ak.description,
"reso": self.ak.reso,
},
}
data["time_constraints"].extend(ak_time_constraints)
for owner in self.ak.owners.all():
data["time_constraints"].extend(_owner_time_constraints(owner))
if self.room is not None and self.fixed:
data["room_constraints"].append(f"availability-room-{self.room.pk}")
if not any(constr.startswith("proxy") for constr in data["room_constraints"]):
data["room_constraints"].append("no-proxy")
return json.dumps(data)
class AKOrgaMessage(models.Model): class AKOrgaMessage(models.Model):
""" """
......
{% extends "admin/base_site.html" %}
{% load tz %}
{% block content %}
<pre>
{"aks": [
{% for slot in slots %}{{ slot.as_json }}{% if not forloop.last %},
{% endif %}{% endfor %}
],
"rooms": [
{% for room in rooms %}{{ room.as_json }}{% if not forloop.last %},
{% endif %}{% endfor %}
],
"participants": {{ participants }},
"timeslots": {{ timeslots }},
"info": {{ info_dict }}
}
</pre>
{% endblock %}
...@@ -5,8 +5,9 @@ from rest_framework.routers import DefaultRouter ...@@ -5,8 +5,9 @@ from rest_framework.routers import DefaultRouter
import AKModel.views.api import AKModel.views.api
from AKModel.views.manage import ExportSlidesView, PlanPublishView, PlanUnpublishView, DefaultSlotEditorView, \ from AKModel.views.manage import ExportSlidesView, PlanPublishView, PlanUnpublishView, DefaultSlotEditorView, \
AKsByUserView AKsByUserView, AKJSONImportView
from AKModel.views.ak import AKRequirementOverview, AKCSVExportView, AKWikiExportView, AKMessageDeleteView from AKModel.views.ak import AKRequirementOverview, AKCSVExportView, AKJSONExportView, AKWikiExportView, \
AKMessageDeleteView
from AKModel.views.event_wizard import NewEventWizardStartView, NewEventWizardPrepareImportView, \ from AKModel.views.event_wizard import NewEventWizardStartView, NewEventWizardPrepareImportView, \
NewEventWizardImportView, NewEventWizardActivateView, NewEventWizardFinishView, NewEventWizardSettingsView NewEventWizardImportView, NewEventWizardActivateView, NewEventWizardFinishView, NewEventWizardSettingsView
from AKModel.views.room import RoomBatchCreationView from AKModel.views.room import RoomBatchCreationView
...@@ -96,6 +97,10 @@ def get_admin_urls_event(admin_site): ...@@ -96,6 +97,10 @@ def get_admin_urls_event(admin_site):
name="aks_by_owner"), name="aks_by_owner"),
path('<slug:event_slug>/ak-csv-export/', admin_site.admin_view(AKCSVExportView.as_view()), path('<slug:event_slug>/ak-csv-export/', admin_site.admin_view(AKCSVExportView.as_view()),
name="ak_csv_export"), name="ak_csv_export"),
path('<slug:event_slug>/ak-json-export/', admin_site.admin_view(AKJSONExportView.as_view()),
name="ak_json_export"),
path('<slug:event_slug>/ak-json-import/', admin_site.admin_view(AKJSONImportView.as_view()),
name="ak_json_import"),
path('<slug:slug>/ak-wiki-export/', admin_site.admin_view(AKWikiExportView.as_view()), path('<slug:slug>/ak-wiki-export/', admin_site.admin_view(AKWikiExportView.as_view()),
name="ak_wiki_export"), name="ak_wiki_export"),
path('<slug:event_slug>/delete-orga-messages/', admin_site.admin_view(AKMessageDeleteView.as_view()), path('<slug:event_slug>/delete-orga-messages/', admin_site.admin_view(AKMessageDeleteView.as_view()),
......
import json
from typing import List
from django.contrib import messages from django.contrib import messages
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic import ListView, DetailView from django.views.generic import ListView, DetailView
from AKModel.availability.models import Availability
from AKModel.metaviews.admin import AdminViewMixin, FilterByEventSlugMixin, EventSlugMixin, IntermediateAdminView, \ from AKModel.metaviews.admin import AdminViewMixin, FilterByEventSlugMixin, EventSlugMixin, IntermediateAdminView, \
IntermediateAdminActionView IntermediateAdminActionView
from AKModel.models import AKRequirement, AKSlot, Event, AKOrgaMessage, AK from AKModel.models import AKRequirement, AKSlot, Event, AKOrgaMessage, AK, Room, AKOwner
class AKRequirementOverview(AdminViewMixin, FilterByEventSlugMixin, ListView): class AKRequirementOverview(AdminViewMixin, FilterByEventSlugMixin, ListView):
...@@ -37,6 +41,129 @@ class AKCSVExportView(AdminViewMixin, FilterByEventSlugMixin, ListView): ...@@ -37,6 +41,129 @@ class AKCSVExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
return super().get_queryset().order_by("ak__track") return super().get_queryset().order_by("ak__track")
class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
"""
View: Export all AK slots of this event in JSON format ordered by tracks
"""
template_name = "admin/AKModel/ak_json_export.html"
model = AKSlot
context_object_name = "slots"
title = _("AK JSON Export")
def _test_slot_contained(self, slot: Availability, availabilities: List[Availability]) -> bool:
return any(availability.contains(slot) for availability in availabilities)
def _test_event_covered(self, availabilities: List[Availability]) -> bool:
return not Availability.is_event_covered(self.event, availabilities)
def _test_fixed_ak(self, ak_id, slot: Availability, ak_fixed: dict) -> bool:
if not ak_id in ak_fixed:
return False
fixed_slot = Availability(self.event, start=ak_fixed[ak_id].start, end=ak_fixed[ak_id].end)
return fixed_slot.overlaps(slot, strict=True)
def _test_add_constraint(self, slot: Availability, availabilities: List[Availability]) -> bool:
return (
self._test_event_covered(availabilities)
and self._test_slot_contained(slot, availabilities)
)
def get_queryset(self):
return super().get_queryset().order_by("ak__track")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["participants"] = json.dumps([])
rooms = Room.objects.filter(event=self.event)
context["rooms"] = rooms
# TODO: Configure magic number in event
SLOTS_IN_AN_HOUR = 1
timeslots = {
"info": {"duration": (1.0 / SLOTS_IN_AN_HOUR), },
"blocks": [],
}
for slot in context["slots"]:
slot.slots_in_an_hour = SLOTS_IN_AN_HOUR
ak_availabilities = {
slot.ak.pk: Availability.union(slot.ak.availabilities.all())
for slot in context["slots"]
}
room_availabilities = {
room.pk: Availability.union(room.availabilities.all())
for room in rooms
}
person_availabilities = {
person.pk: Availability.union(person.availabilities.all())
for person in AKOwner.objects.filter(event=self.event)
}
ak_fixed = {
ak_id: values.get()
for ak_id in ak_availabilities.keys()
if (values := AKSlot.objects.select_related().filter(ak__pk=ak_id, fixed=True)).exists()
}
for block in self.event.default_time_slots(slots_in_an_hour=SLOTS_IN_AN_HOUR):
current_block = []
for slot_index, slot in block:
time_constraints = []
if self.event.reso_deadline is None or slot.end < self.event.reso_deadline:
time_constraints.append("resolution")
time_constraints.extend([
f"availability-ak-{ak_id}"
for ak_id, availabilities in ak_availabilities.items()
if (
self._test_add_constraint(slot, availabilities)
or self._test_fixed_ak(ak_id, slot, ak_fixed)
)
])
time_constraints.extend([
f"availability-person-{person_id}"
for person_id, availabilities in person_availabilities.items()
if self._test_add_constraint(slot, availabilities)
])
time_constraints.extend([
f"availability-room-{room_id}"
for room_id, availabilities in room_availabilities.items()
if self._test_add_constraint(slot, availabilities)
])
current_block.append({
"id": str(slot_index),
"info": {
"start": slot.simplified,
},
"fulfilled_time_constraints": time_constraints,
})
timeslots["blocks"].append(current_block)
context["timeslots"] = json.dumps(timeslots)
info_dict = {
"title": self.event.name,
"slug": self.event.slug
}
for attr in ["contact_email", "place"]:
if hasattr(self.event, attr) and getattr(self.event, attr):
info_dict[attr] = getattr(self.event, attr)
context["info_dict"] = json.dumps(info_dict)
return context
class AKWikiExportView(AdminViewMixin, DetailView): class AKWikiExportView(AdminViewMixin, DetailView):
""" """
View: Export AKs of this event in wiki syntax View: Export AKs of this event in wiki syntax
......
...@@ -4,15 +4,17 @@ import os ...@@ -4,15 +4,17 @@ import os
import tempfile import tempfile
from itertools import zip_longest from itertools import zip_longest
from django.contrib import messages from django.contrib import messages
from django.db.models.functions import Now from django.db.models.functions import Now
from django.shortcuts import redirect
from django.utils.dateparse import parse_datetime from django.utils.dateparse import parse_datetime
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView, DetailView from django.views.generic import TemplateView, DetailView
from django_tex.core import render_template_with_context, run_tex_in_directory from django_tex.core import render_template_with_context, run_tex_in_directory
from django_tex.response import PDFResponse from django_tex.response import PDFResponse
from AKModel.forms import SlideExportForm, DefaultSlotEditorForm from AKModel.forms import SlideExportForm, DefaultSlotEditorForm, JSONImportForm
from AKModel.metaviews.admin import EventSlugMixin, IntermediateAdminView, IntermediateAdminActionView, AdminViewMixin from AKModel.metaviews.admin import EventSlugMixin, IntermediateAdminView, IntermediateAdminActionView, AdminViewMixin
from AKModel.models import ConstraintViolation, Event, DefaultSlot, AKOwner from AKModel.models import ConstraintViolation, Event, DefaultSlot, AKOwner
...@@ -58,7 +60,7 @@ class ExportSlidesView(EventSlugMixin, IntermediateAdminView): ...@@ -58,7 +60,7 @@ class ExportSlidesView(EventSlugMixin, IntermediateAdminView):
Create a list of tuples cosisting of an AK and a list of upcoming AKs (list length depending on setting) Create a list of tuples cosisting of an AK and a list of upcoming AKs (list length depending on setting)
""" """
next_aks_list = zip_longest(*[ak_list[i + 1:] for i in range(NEXT_AK_LIST_LENGTH)], fillvalue=None) next_aks_list = zip_longest(*[ak_list[i + 1:] for i in range(NEXT_AK_LIST_LENGTH)], fillvalue=None)
return [(ak, next_aks) for ak, next_aks in zip_longest(ak_list, next_aks_list, fillvalue=[])] return list(zip_longest(ak_list, next_aks_list, fillvalue=[]))
# Get all relevant AKs (wishes separately, and either all AKs or only those who should directly or indirectly # Get all relevant AKs (wishes separately, and either all AKs or only those who should directly or indirectly
# be presented when restriction setting was chosen) # be presented when restriction setting was chosen)
...@@ -245,3 +247,16 @@ class AKsByUserView(AdminViewMixin, EventSlugMixin, DetailView): ...@@ -245,3 +247,16 @@ class AKsByUserView(AdminViewMixin, EventSlugMixin, DetailView):
model = AKOwner model = AKOwner
context_object_name = 'owner' context_object_name = 'owner'
template_name = "admin/AKModel/aks_by_user.html" template_name = "admin/AKModel/aks_by_user.html"
class AKJSONImportView(EventSlugMixin, IntermediateAdminView):
"""
View: Import an AK schedule from a json file that can be pasted into this view.
"""
form_class = JSONImportForm
title = _("AK JSON Import")
def form_valid(self, form):
self.event.schedule_from_json(form.data["json_data"])
return redirect("admin:event_status", self.event.slug)
...@@ -133,10 +133,18 @@ class EventAKsWidget(TemplateStatusWidget): ...@@ -133,10 +133,18 @@ class EventAKsWidget(TemplateStatusWidget):
"text": _("Manage ak tracks"), "text": _("Manage ak tracks"),
"url": reverse_lazy("admin:tracks_manage", kwargs={"event_slug": context["event"].slug}), "url": reverse_lazy("admin:tracks_manage", kwargs={"event_slug": context["event"].slug}),
}, },
{
"text": _("Import AK schedule from JSON"),
"url": reverse_lazy("admin:ak_json_import", kwargs={"event_slug": context["event"].slug}),
},
{ {
"text": _("Export AKs as CSV"), "text": _("Export AKs as CSV"),
"url": reverse_lazy("admin:ak_csv_export", kwargs={"event_slug": context["event"].slug}), "url": reverse_lazy("admin:ak_csv_export", kwargs={"event_slug": context["event"].slug}),
}, },
{
"text": _("Export AKs as JSON"),
"url": reverse_lazy("admin:ak_json_export", kwargs={"event_slug": context["event"].slug}),
},
{ {
"text": _("Export AKs for Wiki"), "text": _("Export AKs for Wiki"),
"url": reverse_lazy("admin:ak_wiki_export", kwargs={"slug": context["event"].slug}), "url": reverse_lazy("admin:ak_wiki_export", kwargs={"slug": context["event"].slug}),
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-15 20:03+0200\n" "POT-Creation-Date: 2024-05-27 01:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -38,7 +38,7 @@ msgstr "Veranstaltung" ...@@ -38,7 +38,7 @@ msgstr "Veranstaltung"
#: AKPlan/templates/AKPlan/plan_index.html:59 #: AKPlan/templates/AKPlan/plan_index.html:59
#: AKPlan/templates/AKPlan/plan_room.html:13 #: AKPlan/templates/AKPlan/plan_room.html:13
#: AKPlan/templates/AKPlan/plan_room.html:59 #: AKPlan/templates/AKPlan/plan_room.html:59
#: AKPlan/templates/AKPlan/plan_wall.html:65 #: AKPlan/templates/AKPlan/plan_wall.html:67
msgid "Room" msgid "Room"
msgstr "Raum" msgstr "Raum"
...@@ -63,12 +63,12 @@ msgid "AK Wall" ...@@ -63,12 +63,12 @@ msgid "AK Wall"
msgstr "AK-Wall" msgstr "AK-Wall"
#: AKPlan/templates/AKPlan/plan_index.html:130 #: AKPlan/templates/AKPlan/plan_index.html:130
#: AKPlan/templates/AKPlan/plan_wall.html:130 #: AKPlan/templates/AKPlan/plan_wall.html:132
msgid "Current AKs" msgid "Current AKs"
msgstr "Aktuelle AKs" msgstr "Aktuelle AKs"
#: AKPlan/templates/AKPlan/plan_index.html:137 #: AKPlan/templates/AKPlan/plan_index.html:137
#: AKPlan/templates/AKPlan/plan_wall.html:135 #: AKPlan/templates/AKPlan/plan_wall.html:137
msgid "Next AKs" msgid "Next AKs"
msgstr "Nächste AKs" msgstr "Nächste AKs"
...@@ -99,7 +99,7 @@ msgstr "Eigenschaften" ...@@ -99,7 +99,7 @@ msgstr "Eigenschaften"
msgid "Track" msgid "Track"
msgstr "Track" msgstr "Track"
#: AKPlan/templates/AKPlan/plan_wall.html:145 #: AKPlan/templates/AKPlan/plan_wall.html:147
msgid "Reload page automatically?" msgid "Reload page automatically?"
msgstr "Seite automatisch neu laden?" msgstr "Seite automatisch neu laden?"
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-16 16:30+0200\n" "POT-Creation-Date: 2024-05-27 01:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -17,10 +17,10 @@ msgstr "" ...@@ -17,10 +17,10 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: AKPlanning/settings.py:148 #: AKPlanning/settings.py:147
msgid "German" msgid "German"
msgstr "Deutsch" msgstr "Deutsch"
#: AKPlanning/settings.py:149 #: AKPlanning/settings.py:148
msgid "English" msgid "English"
msgstr "Englisch" msgstr "Englisch"
...@@ -288,6 +288,8 @@ def ak_requirements_changed_handler(sender, instance: AK, action: str, **kwargs) ...@@ -288,6 +288,8 @@ def ak_requirements_changed_handler(sender, instance: AK, action: str, **kwargs)
for slot in slots_of_this_ak: for slot in slots_of_this_ak:
room = slot.room room = slot.room
if room is None:
continue
room_requirements = room.properties.all() room_requirements = room.properties.all()
for requirement in instance.requirements.all(): for requirement in instance.requirements.all():
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-16 16:30+0200\n" "POT-Creation-Date: 2024-05-27 01:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -17,16 +17,16 @@ msgstr "" ...@@ -17,16 +17,16 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: AKSubmission/forms.py:93 #: AKSubmission/forms.py:95
#, python-format #, python-format
msgid "\"%(duration)s\" is not a valid duration" msgid "\"%(duration)s\" is not a valid duration"
msgstr "\"%(duration)s\" ist keine gültige Dauer" msgstr "\"%(duration)s\" ist keine gültige Dauer"
#: AKSubmission/forms.py:159 #: AKSubmission/forms.py:155
msgid "Duration(s)" msgid "Duration(s)"
msgstr "Dauer(n)" msgstr "Dauer(n)"
#: AKSubmission/forms.py:161 #: AKSubmission/forms.py:157
msgid "" msgid ""
"Enter at least one planned duration (in hours). If your AK should have " "Enter at least one planned duration (in hours). If your AK should have "
"multiple slots, use multiple lines" "multiple slots, use multiple lines"
......
...@@ -10,7 +10,7 @@ setup. ...@@ -10,7 +10,7 @@ setup.
### System Requirements ### System Requirements
* Python 3.8+ incl. development tools * Python 3.10+ incl. development tools
* Virtualenv * Virtualenv
* pdflatex & beamer * pdflatex & beamer
class (`texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-extra texlive-luatex`) class (`texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-extra texlive-luatex`)
...@@ -37,7 +37,7 @@ Python requirements are listed in ``requirements.txt``. They can be installed wi ...@@ -37,7 +37,7 @@ Python requirements are listed in ``requirements.txt``. They can be installed wi
### Manual Setup ### Manual Setup
1. setup a virtual environment using the proper python version ``virtualenv venv -p python3.7`` 1. setup a virtual environment using the proper python version ``virtualenv venv -p python3.10``
1. activate virtualenv ``source venv/bin/activate`` 1. activate virtualenv ``source venv/bin/activate``
1. install python requirements ``pip install -r requirements.txt`` 1. install python requirements ``pip install -r requirements.txt``
1. setup necessary database tables etc. ``python manage.py migrate`` 1. setup necessary database tables etc. ``python manage.py migrate``
...@@ -68,7 +68,7 @@ is not stored in any repository or similar, and disable DEBUG mode (``settings.p ...@@ -68,7 +68,7 @@ is not stored in any repository or similar, and disable DEBUG mode (``settings.p
1. create a folder, e.g. ``mkdir /srv/AKPlanning/`` 1. create a folder, e.g. ``mkdir /srv/AKPlanning/``
1. change to the new directory ``cd /srv/AKPlanning/`` 1. change to the new directory ``cd /srv/AKPlanning/``
1. clone this repository ``git clone URL .`` 1. clone this repository ``git clone URL .``
1. setup a virtual environment using the proper python version ``virtualenv venv -p python3.7`` 1. setup a virtual environment using the proper python version ``virtualenv venv -p python3.10``
1. activate virtualenv ``source venv/bin/activate`` 1. activate virtualenv ``source venv/bin/activate``
1. update tools ``pip install --upgrade setuptools pip wheel`` 1. update tools ``pip install --upgrade setuptools pip wheel``
1. install python requirements ``pip install -r requirements.txt`` 1. install python requirements ``pip install -r requirements.txt``
......
...@@ -10,7 +10,7 @@ rm -rf venv/ ...@@ -10,7 +10,7 @@ rm -rf venv/
# Setup Python Environment # Setup Python Environment
# Requires: Virtualenv, appropriate Python installation # Requires: Virtualenv, appropriate Python installation
virtualenv venv -p python3.9 virtualenv venv -p python3.10
source venv/bin/activate source venv/bin/activate
pip install --upgrade setuptools pip wheel pip install --upgrade setuptools pip wheel
pip install -r requirements.txt pip install -r requirements.txt
......