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
Showing
with 3654 additions and 191 deletions
# Create your views here. from django.apps import apps
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic import TemplateView, DetailView
from django.utils.translation import gettext_lazy as _
from AKModel.models import Event, AK, AKSlot
from AKPlanning import settings
class DashboardView(TemplateView):
"""
Index view of dashboard and therefore the main entry point for AKPlanning
Displays information and buttons for all public events
"""
template_name = 'AKDashboard/dashboard.html'
@method_decorator(ensure_csrf_cookie)
def dispatch(self, *args, **kwargs):
return super().dispatch(*args, **kwargs)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# Load events and split between active and current/featured events and those that should show smaller below
context["active_and_current_events"] = []
context["old_events"] = []
events = Event.objects.filter(public=True).order_by("-active", "-pk").prefetch_related('dashboardbutton_set')
for event in events:
if event.active or len(context["active_and_current_events"]) < settings.DASHBOARD_MAX_FEATURED_EVENTS:
context["active_and_current_events"].append(event)
else:
context["old_events"].append(event)
context["active_event_count"] = len(context["active_and_current_events"])
context["old_event_count"] = len(context["old_events"])
context["total_event_count"] = context["active_event_count"] + context["old_event_count"]
return context
class DashboardEventView(DetailView):
"""
Dashboard view for a single event
In addition to the basic information and the buttons,
an overview over recent events (new and changed AKs, moved AKSlots) for the given event is shown.
The event dashboard also exists for non-public events (one only needs to know the URL/slug of the event).
"""
template_name = 'AKDashboard/dashboard_event.html'
context_object_name = 'event'
model = Event
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# Show feed of recent changes (if activated)
if settings.DASHBOARD_SHOW_RECENT:
# Create a list of chronically sorted events (both AK and plan changes):
recent_changes = []
# Newest AKs (if AKSubmission is used)
if apps.is_installed("AKSubmission"):
# Get the latest x changes (if there are that many),
# where x corresponds to the entry threshold configured in the settings
# (such that the list will be completely filled even if there are no (newer) plan changes)
submission_changes = AK.history.filter(event=context['event'])[:int(settings.DASHBOARD_RECENT_MAX)] # pylint: disable=no-member, line-too-long
# Create textual representation including icons
for s in submission_changes:
if s.history_type == '+':
text = _('New AK: %(ak)s.') % {'ak': s.name}
icon = ('plus-square', 'far')
elif s.history_type == '~':
text = _('AK "%(ak)s" edited.') % {'ak': s.name}
icon = ('pen-square', 'fas')
else:
text = _('AK "%(ak)s" deleted.') % {'ak': s.name}
icon = ('times', 'fas')
# Store representation in change list (still unsorted)
recent_changes.append(
{'icon': icon, 'text': text, 'link': s.instance.detail_url, 'timestamp': s.history_date}
)
# Changes in plan (if AKPlan is used and plan is publicly visible)
if apps.is_installed("AKPlan") and not context['event'].plan_hidden:
# Get the latest plan changes (again using a threshold, see above)
last_changed_slots = AKSlot.objects.select_related('ak').filter(event=context['event'], start__isnull=False).order_by('-updated')[:int(settings.DASHBOARD_RECENT_MAX)] #pylint: disable=line-too-long
for changed_slot in last_changed_slots:
# Create textual representation including icons and links and store in list (still unsorted)
recent_changes.append({'icon': ('clock', 'far'),
'text': _('AK "%(ak)s" (re-)scheduled.') % {'ak': changed_slot.ak.name},
'link': changed_slot.ak.detail_url,
'timestamp': changed_slot.updated})
# Sort by change date...
recent_changes.sort(key=lambda x: x['timestamp'], reverse=True)
# ... and restrict to the latest 25 changes
context['recent_changes'] = recent_changes[:int(settings.DASHBOARD_RECENT_MAX)]
else:
context['recent_changes'] = []
return context
# Register your models here. from django import forms
from django.apps import apps
from django.contrib import admin, messages
from django.contrib.admin import SimpleListFilter, RelatedFieldListFilter, action, display
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User # pylint: disable=E5142
from django.db.models import Count, F
from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect
from django.urls import reverse_lazy, path
from django.utils import timezone
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from simple_history.admin import SimpleHistoryAdmin
from django.contrib import admin from AKModel.availability.models import Availability
from AKModel.forms import RoomFormWithAvailabilities
from AKModel.models import Event, AKOwner, AKCategory, AKTrack, AKRequirement, AK, AKSlot, Room, AKOrgaMessage, \
ConstraintViolation, DefaultSlot, AKType
from AKModel.urls import get_admin_urls_event_wizard, get_admin_urls_event
from AKModel.views.ak import AKResetInterestView, AKResetInterestCounterView
from AKModel.views.manage import CVMarkResolvedView, CVSetLevelViolationView, CVSetLevelWarningView
from AKModel.availability import Availability
from AKModel.models import Event, AKOwner, AKCategory, AKTrack, AKTag, AKRequirement, AK, Room, AKSlot
admin.site.register(Event) class EventRelatedFieldListFilter(RelatedFieldListFilter):
"""
Reusable filter to restrict the possible choices of a field to those belonging to a certain event
as specified in the event__id__exact GET parameter.
The choices are only restricted if this parameter is present, otherwise all choices are used/returned
"""
def field_choices(self, field, request, model_admin):
ordering = self.field_admin_ordering(field, request, model_admin)
limit_choices = {}
if "event__id__exact" in request.GET:
limit_choices['event__id__exact'] = request.GET["event__id__exact"]
return field.get_choices(include_blank=False, limit_choices_to=limit_choices, ordering=ordering)
admin.site.register(AKOwner)
admin.site.register(AKCategory) @admin.register(Event)
admin.site.register(AKTrack) class EventAdmin(admin.ModelAdmin):
admin.site.register(AKTag) """
admin.site.register(AKRequirement) Admin interface for Event
This allows to edit most fields of an event, some can only be changed by admin actions, since they have side effects
class AKAdmin(admin.ModelAdmin): This admin interface registers additional views as defined in urls.py, the wizard, and the full scheduling
functionality if the AKScheduling app is active.
The interface overrides the built-in creation interface for a new event and replaces it with the event creation
wizard.
"""
model = Event
list_display = ['name', 'status_url', 'place', 'start', 'end', 'active', 'plan_hidden']
list_filter = ['active']
list_editable = ['active']
ordering = ['-start']
readonly_fields = ['status_url', 'plan_hidden', 'plan_published_at', 'toggle_plan_visibility']
actions = ['publish', 'unpublish']
def add_view(self, request, form_url='', extra_context=None):
# Override
# Always use wizard to create new events (the built-in form wouldn't work anyway since the timezone cannot
# be specified before starting to fill the form)
return redirect("admin:new_event_wizard_start")
def get_urls(self):
"""
Get all event-related URLs
This will be both the built-in URLs and additional views providing additional functionality
:return: list of all relevant URLs
:rtype: List[path]
"""
# Load wizard URLs and the additional URLs defined in urls.py
# (first, to have the highest priority when overriding views)
urls = get_admin_urls_event_wizard(self.admin_site)
urls.extend(get_admin_urls_event(self.admin_site))
# Make scheduling admin views available if app is active
if apps.is_installed("AKScheduling"):
from AKScheduling.urls import get_admin_urls_scheduling # pylint: disable=import-outside-toplevel
urls.extend(get_admin_urls_scheduling(self.admin_site))
# Make sure built-in URLs are available as well
urls.extend(super().get_urls())
return urls
@display(description=_("Status"))
def status_url(self, obj):
"""
Define a read-only field to go to the status page of the event
:param obj: the event to link
:return: status page link (HTML)
:rtype: str
"""
return format_html("<a href='{url}'>{text}</a>",
url=reverse_lazy('admin:event_status', kwargs={'event_slug': obj.slug}), text=_("Status"))
@display(description=_("Toggle plan visibility"))
def toggle_plan_visibility(self, obj):
"""
Define a read-only field to toggle the visibility of the plan of this event
This will choose from two different link targets/views depending on the current visibility status
:param obj: event to change the visibility of the plan for
:return: toggling link (HTML)
:rtype: str
"""
if obj.plan_hidden:
url = f"{reverse_lazy('admin:plan-publish')}?pks={obj.pk}"
text = _('Publish plan')
else:
url = f"{reverse_lazy('admin:plan-unpublish')}?pks={obj.pk}"
text = _('Unpublish plan')
return format_html("<a href='{url}'>{text}</a>", url=url, text=text)
def get_form(self, request, obj=None, change=False, **kwargs):
# Override (update) form rendering to make sure the timezone of the event is used
timezone.activate(obj.timezone)
return super().get_form(request, obj, change, **kwargs)
@action(description=_('Publish plan'))
def publish(self, request, queryset):
"""
Admin action to publish the plan
"""
selected = queryset.values_list('pk', flat=True)
return HttpResponseRedirect(f"{reverse_lazy('admin:plan-publish')}?pks={','.join(str(pk) for pk in selected)}")
@action(description=_('Unpublish plan'))
def unpublish(self, request, queryset):
"""
Admin action to hide the plan
"""
selected = queryset.values_list('pk', flat=True)
return HttpResponseRedirect(
f"{reverse_lazy('admin:plan-unpublish')}?pks={','.join(str(pk) for pk in selected)}")
class PrepopulateWithNextActiveEventMixin:
"""
Mixin for automated pre-population of the event field
"""
# pylint: disable=too-few-public-methods
def formfield_for_foreignkey(self, db_field, request, **kwargs):
"""
Override field generation for foreign key fields to introduce special handling for event fields:
Pre-populate the event field with the next active event (since that is the most likeliest event to be worked
on in the admin interface) to make creation of new owners easier
"""
if db_field.name == 'event':
kwargs['initial'] = Event.get_next_active()
return super().formfield_for_foreignkey(db_field, request, **kwargs)
@admin.register(AKOwner)
class AKOwnerAdmin(PrepopulateWithNextActiveEventMixin, admin.ModelAdmin):
"""
Admin interface for AKOwner
"""
model = AKOwner
list_display = ['name', 'institution', 'event', 'aks_url']
list_filter = ['event', 'institution']
list_editable = []
ordering = ['name']
readonly_fields = ['aks_url']
@display(description=_("AKs"))
def aks_url(self, obj):
"""
Define a read-only field to go to the list of all AKs by this user
:param obj: user
:return: AK list page link (HTML)
:rtype: str
"""
return format_html("<a href='{url}'>{text}</a>",
url=reverse_lazy('admin:aks_by_owner', kwargs={'event_slug': obj.event.slug, 'pk': obj.pk}),
text=obj.ak_set.count())
@admin.register(AKCategory)
class AKCategoryAdmin(PrepopulateWithNextActiveEventMixin, admin.ModelAdmin):
"""
Admin interface for AKCategory
"""
model = AKCategory
list_display = ['name', 'color', 'event']
list_filter = ['event']
list_editable = ['color']
ordering = ['name']
@admin.register(AKTrack)
class AKTrackAdmin(PrepopulateWithNextActiveEventMixin, admin.ModelAdmin):
"""
Admin interface for AKTrack
"""
model = AKTrack
list_display = ['name', 'color', 'event']
list_filter = ['event']
list_editable = ['color']
ordering = ['name']
@admin.register(AKRequirement)
class AKRequirementAdmin(PrepopulateWithNextActiveEventMixin, admin.ModelAdmin):
"""
Admin interface for AKRequirements
"""
model = AKRequirement
list_display = ['name', 'event']
list_filter = ['event']
list_editable = []
ordering = ['name']
@admin.register(AKType)
class AKTypeAdmin(PrepopulateWithNextActiveEventMixin, admin.ModelAdmin):
"""
Admin interface for AKRequirements
"""
model = AKType
list_display = ['name', 'event']
list_filter = ['event']
list_editable = []
ordering = ['name']
class WishFilter(SimpleListFilter):
"""
Re-usable filter for wishes
"""
title = _("Wish") # a label for our filter
parameter_name = 'wishes' # you can put anything here
def lookups(self, request, model_admin):
# This is where you create filter options; we have two:
return [
('WISH', _("Is wish")),
('NO_WISH', _("Is not a wish")),
]
def queryset(self, request, queryset):
annotated_queryset = queryset.annotate(owner_count=Count(F('owners')))
if self.value() == 'NO_WISH':
return annotated_queryset.filter(owner_count__gt=0)
if self.value() == 'WISH':
return annotated_queryset.filter(owner_count=0)
return queryset
class AKAdminForm(forms.ModelForm):
"""
Modified admin form for AKs, to be used in :class:`AKAdmin`
"""
class Meta:
widgets = {
'requirements': forms.CheckboxSelectMultiple,
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Filter possible values for foreign keys & m2m when event is specified
if hasattr(self.instance, "event") and self.instance.event is not None:
self.fields["category"].queryset = AKCategory.objects.filter(event=self.instance.event)
self.fields["track"].queryset = AKTrack.objects.filter(event=self.instance.event)
self.fields["owners"].queryset = AKOwner.objects.filter(event=self.instance.event)
self.fields["requirements"].queryset = AKRequirement.objects.filter(event=self.instance.event)
self.fields["conflicts"].queryset = AK.objects.filter(event=self.instance.event)
self.fields["prerequisites"].queryset = AK.objects.filter(event=self.instance.event)
self.fields["types"].queryset = AKType.objects.filter(event=self.instance.event)
@admin.register(AK)
class AKAdmin(PrepopulateWithNextActiveEventMixin, SimpleHistoryAdmin):
"""
Admin interface for AKs
Uses a modified form (see :class:`AKAdminForm`)
"""
model = AK model = AK
list_display = ['name', 'short_name', 'category', 'is_wish'] list_display = ['name', 'short_name', 'category', 'track', 'is_wish', 'interest', 'interest_counter', 'event']
list_filter = ['event',
WishFilter,
('category', EventRelatedFieldListFilter),
('requirements', EventRelatedFieldListFilter)
]
list_editable = ['short_name', 'track', 'interest_counter']
ordering = ['pk']
actions = ['wiki_export', 'reset_interest', 'reset_interest_counter']
form = AKAdminForm
@display(boolean=True)
def is_wish(self, obj): def is_wish(self, obj):
"""
Property: Is this AK a wish?
"""
return obj.wish return obj.wish
is_wish.boolean = True @action(description=_("Export to wiki syntax"))
def wiki_export(self, request, queryset):
"""
Action: Export to wiki syntax
This will use the wiki export view (therefore, all AKs have to have the same event to correclty handle the
categories and to prevent accidentially merging AKs from different events in the wiki)
but restrict the AKs to the ones explicitly selected here.
"""
# Only export when all AKs belong to the same event
if queryset.values("event").distinct().count() == 1:
event = queryset.first().event
pks = set(ak.pk for ak in queryset.all())
categories_with_aks = event.get_categories_with_aks(wishes_seperately=False,
filter_func=lambda ak: ak.pk in pks,
hide_empty_categories=True)
return render(request, 'admin/AKModel/wiki_export.html',
context={"categories_with_aks": categories_with_aks})
self.message_user(request, _("Cannot export AKs from more than one event at the same time."), messages.ERROR)
return redirect('admin:AKModel_ak_changelist')
def get_urls(self):
"""
Add additional URLs/views
Currently used to reset the interest field and interest counter field
"""
urls = [
path('reset-interest/', AKResetInterestView.as_view(), name="ak-reset-interest"),
path('reset-interest-counter/', AKResetInterestCounterView.as_view(), name="ak-reset-interest-counter"),
]
urls.extend(super().get_urls())
return urls
@action(description=_("Reset interest in AKs"))
def reset_interest(self, request, queryset):
"""
Action: Reset interest field for the given AKs
Will use a typical admin confirmation view flow
"""
selected = queryset.values_list('pk', flat=True)
return HttpResponseRedirect(
f"{reverse_lazy('admin:ak-reset-interest')}?pks={','.join(str(pk) for pk in selected)}")
@action(description=_("Reset AKs' interest counters"))
def reset_interest_counter(self, request, queryset):
"""
Action: Reset interest counter field for the given AKs
Will use a typical admin confirmation view flow
"""
selected = queryset.values_list('pk', flat=True)
return HttpResponseRedirect(
f"{reverse_lazy('admin:ak-reset-interest-counter')}?pks={','.join(str(pk) for pk in selected)}")
@admin.register(Room)
class RoomAdmin(PrepopulateWithNextActiveEventMixin, admin.ModelAdmin):
"""
Admin interface for Rooms
"""
model = Room
list_display = ['name', 'location', 'capacity', 'event']
list_filter = ['event', ('properties', EventRelatedFieldListFilter), 'location']
list_editable = []
ordering = ['location', 'name']
change_form_template = "admin/AKModel/room_change_form.html"
def add_view(self, request, form_url='', extra_context=None):
# Override creation view
# Use custom view for room creation (either room form or combined form if virtual rooms are supported)
return redirect("admin:room-new")
def get_form(self, request, obj=None, change=False, **kwargs):
# Override form creation to use a form that allows to specify availabilites of the room once this room is
# associated with an event (so not before the first saving) since the timezone information and event start
# and end are needed to correclty render the calendar
if obj is not None:
return RoomFormWithAvailabilities
return super().get_form(request, obj, change, **kwargs)
def get_urls(self):
"""
Add additional URLs/views
This is currently used to adapt the creation form behavior, to allow the creation of virtual rooms in-place
when the support for virtual rooms is turned on (AKOnline app active)
"""
# pylint: disable=import-outside-toplevel
if apps.is_installed("AKOnline"):
from AKOnline.views import RoomCreationWithVirtualView as RoomCreationView
else:
from .views.room import RoomCreationView
urls = [
path('new/', self.admin_site.admin_view(RoomCreationView.as_view()), name="room-new"),
]
urls.extend(super().get_urls())
return urls
class EventTimezoneFormMixin:
"""
Mixin to enforce the usage of the timezone of the associated event in forms
"""
# pylint: disable=too-few-public-methods
def get_form(self, request, obj=None, change=False, **kwargs):
"""
Override form creation, use timezone of associated event
"""
if obj is not None and obj.event.timezone:
timezone.activate(obj.event.timezone)
# No timezone available? Use UTC
else:
timezone.activate("UTC")
return super().get_form(request, obj, change, **kwargs)
class AKSlotAdminForm(forms.ModelForm):
"""
Modified admin form for AKSlots, to be used in :class:`AKSlotAdmin`
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Filter possible values for foreign keys when event is specified
if hasattr(self.instance, "event") and self.instance.event is not None:
self.fields["ak"].queryset = AK.objects.filter(event=self.instance.event)
self.fields["room"].queryset = Room.objects.filter(event=self.instance.event)
@admin.register(AKSlot)
class AKSlotAdmin(EventTimezoneFormMixin, PrepopulateWithNextActiveEventMixin, admin.ModelAdmin):
"""
Admin interface for AKSlots
Uses a modified form (see :class:`AKSlotAdminForm`)
"""
model = AKSlot
list_display = ['id', 'ak', 'room', 'start', 'duration', 'event']
list_filter = ['event', ('room', EventRelatedFieldListFilter)]
ordering = ['start']
readonly_fields = ['ak_details_link', 'updated']
form = AKSlotAdminForm
@display(description=_('AK Details'))
def ak_details_link(self, akslot):
"""
Define a read-only field to link the details of the associated AK
:param obj: the AK to link
:return: AK detail page page link (HTML)
:rtype: str
"""
if apps.is_installed("AKSubmission") and akslot.ak is not None:
link = f"<a href='{ akslot.ak.detail_url }'>{str(akslot.ak)}</a>"
return mark_safe(str(link))
return "-"
ak_details_link.short_description = _('AK Details')
@admin.register(Availability)
class AvailabilityAdmin(EventTimezoneFormMixin, admin.ModelAdmin):
"""
Admin interface for Availabilities
"""
list_display = ['__str__', 'event']
list_filter = ['event']
@admin.register(AKOrgaMessage)
class AKOrgaMessageAdmin(admin.ModelAdmin):
"""
Admin interface for AKOrgaMessages
"""
list_display = ['timestamp', 'ak', 'text', 'resolved']
list_filter = ['ak__event']
readonly_fields = ['timestamp', 'ak', 'text']
class ConstraintViolationAdminForm(forms.ModelForm):
"""
Adapted admin form for constraint violations for usage in :class:`ConstraintViolationAdmin`)
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Filter possible values for foreign keys & m2m when event is specified
if hasattr(self.instance, "event") and self.instance.event is not None:
self.fields["ak_owner"].queryset = AKOwner.objects.filter(event=self.instance.event)
self.fields["room"].queryset = Room.objects.filter(event=self.instance.event)
self.fields["requirement"].queryset = AKRequirement.objects.filter(event=self.instance.event)
self.fields["category"].queryset = AKCategory.objects.filter(event=self.instance.event)
self.fields["aks"].queryset = AK.objects.filter(event=self.instance.event)
self.fields["ak_slots"].queryset = AKSlot.objects.filter(event=self.instance.event)
@admin.register(ConstraintViolation)
class ConstraintViolationAdmin(admin.ModelAdmin):
"""
Admin interface for constraint violations
Uses an adapted form (see :class:`ConstraintViolationAdminForm`)
"""
list_display = ['type', 'level', 'get_details', 'manually_resolved']
list_filter = ['event']
readonly_fields = ['timestamp']
form = ConstraintViolationAdminForm
actions = ['mark_resolved', 'set_violation', 'set_warning']
def get_urls(self):
"""
Add additional URLs/views to change status and severity of CVs
"""
urls = [
path('mark-resolved/', CVMarkResolvedView.as_view(), name="cv-mark-resolved"),
path('set-violation/', CVSetLevelViolationView.as_view(), name="cv-set-violation"),
path('set-warning/', CVSetLevelWarningView.as_view(), name="cv-set-warning"),
]
urls.extend(super().get_urls())
return urls
@action(description=_("Mark Constraint Violations as manually resolved"))
def mark_resolved(self, request, queryset):
"""
Action: Mark CV as resolved
"""
selected = queryset.values_list('pk', flat=True)
return HttpResponseRedirect(
f"{reverse_lazy('admin:cv-mark-resolved')}?pks={','.join(str(pk) for pk in selected)}")
@action(description=_('Set Constraint Violations to level "violation"'))
def set_violation(self, request, queryset):
"""
Action: Promote CV to level violation
"""
selected = queryset.values_list('pk', flat=True)
return HttpResponseRedirect(
f"{reverse_lazy('admin:cv-set-violation')}?pks={','.join(str(pk) for pk in selected)}")
@action(description=_('Set Constraint Violations to level "warning"'))
def set_warning(self, request, queryset):
"""
Action: Set CV to level warning
"""
selected = queryset.values_list('pk', flat=True)
return HttpResponseRedirect(
f"{reverse_lazy('admin:cv-set-warning')}?pks={','.join(str(pk) for pk in selected)}")
class DefaultSlotAdminForm(forms.ModelForm):
"""
Adapted admin form for DefaultSlot for usage in :class:`DefaultSlotAdmin`
"""
class Meta:
widgets = {
'primary_categories': forms.CheckboxSelectMultiple
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Filter possible values for foreign keys & m2m when event is specified
if hasattr(self.instance, "event") and self.instance.event is not None:
self.fields["primary_categories"].queryset = AKCategory.objects.filter(event=self.instance.event)
@admin.register(DefaultSlot)
class DefaultSlotAdmin(EventTimezoneFormMixin, admin.ModelAdmin):
"""
Admin interface for default slots
Uses an adapted form (see :class:`DefaultSlotAdminForm`)
"""
list_display = ['start_simplified', 'end_simplified', 'event']
list_filter = ['event']
form = DefaultSlotAdminForm
# Define a new User admin
class UserAdmin(BaseUserAdmin):
"""
Admin interface for Users
Enhances the built-in UserAdmin with additional actions to activate and deactivate users and a custom selection
of displayed properties in overview list
"""
list_display = ["username", "email", "is_active", "is_staff", "is_superuser"]
actions = ['activate', 'deactivate']
@admin.action(description=_("Activate selected users"))
def activate(self, request, queryset):
"""
Bulk activate users
:param request: HTTP request
:param queryset: queryset containing all users that should be activated
"""
queryset.update(is_active=True)
self.message_user(request, _("The selected users have been activated."))
admin.site.register(AK, AKAdmin) @admin.action(description=_("Deactivate selected users"))
def deactivate(self, request, queryset):
"""
Bulk deactivate users
admin.site.register(Room) :param request: HTTP request
:param queryset: queryset containing all users that should be deactivated
"""
queryset.update(is_active=False)
self.message_user(request, _("The selected users have been deactivated."))
admin.site.register(AKSlot)
admin.site.register(Availability) # Re-register UserAdmin
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
from django.apps import AppConfig from django.apps import AppConfig
from django.contrib.admin.apps import AdminConfig
class AkmodelConfig(AppConfig): class AkmodelConfig(AppConfig):
"""
App configuration (default, only specifies name of the app)
"""
name = 'AKModel' name = 'AKModel'
class AKAdminConfig(AdminConfig):
"""
App configuration for admin
Loading a custom version here allows to add additional contex and further adapt the behavior of the admin interface
"""
default_site = 'AKModel.site.AKAdminSite'
# This part of the code was adapted from pretalx (https://github.com/pretalx/pretalx)
# Copyright 2017-2019, Tobias Kunze
# Original Copyrights licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
# Documentation was mainly added by us, other changes are marked in the code
import datetime
import json
from django import forms
from django.db import transaction
from django.db.models.signals import post_save
from django.utils.dateparse import parse_datetime
from django.utils.translation import gettext_lazy as _
from AKModel.availability.models import Availability
from AKModel.availability.serializers import AvailabilitySerializer
from AKModel.models import Event
class AvailabilitiesFormMixin(forms.Form):
"""
Mixin for forms to add availabilities functionality to it
Will handle the rendering and population of an availabilities field
"""
availabilities = forms.CharField(
label=_('Availability'),
help_text=_(
'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.' # Adapted help text
),
widget=forms.TextInput(attrs={'class': 'availabilities-editor-data'}),
required=False,
)
def _serialize(self, event, instance):
"""
Serialize relevant availabilities into a JSON format to populate the text field in the form
:param event: event the availabilities belong to (relevant for start and end times)
:param instance: the entity availabilities in this form should belong to (e.g., an AK, or a Room)
:return: JSON serializiation of the relevant availabilities
:rtype: str
"""
if instance:
availabilities = AvailabilitySerializer(
instance.availabilities.all(), many=True
).data
else:
availabilities = []
return json.dumps(
{
'availabilities': availabilities,
'event': {
# 'timezone': event.timezone,
'date_from': str(event.start),
'date_to': str(event.end),
},
}
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Load event information and populate availabilities text field
self.event = self.initial.get('event')
if isinstance(self.event, int):
self.event = Event.objects.get(pk=self.event)
initial = kwargs.pop('initial', {})
initial['availabilities'] = self._serialize(self.event, kwargs['instance'])
if not isinstance(self, forms.BaseModelForm):
kwargs.pop('instance')
kwargs['initial'] = initial
def _parse_availabilities_json(self, jsonavailabilities):
"""
Turn raw JSON availabilities into a list of model instances
:param jsonavailabilities: raw json input
:return: a list of availability objects corresponding to the raw input
:rtype: List[Availability]
"""
try:
rawdata = json.loads(jsonavailabilities)
except ValueError as exc:
raise forms.ValidationError("Submitted availabilities are not valid json.") from exc
if not isinstance(rawdata, dict):
raise forms.ValidationError(
"Submitted json does not comply with expected format, should be object."
)
availabilities = rawdata.get('availabilities')
if not isinstance(availabilities, list):
raise forms.ValidationError(
"Submitted json does not comply with expected format, missing or malformed availabilities field"
)
return availabilities
def _parse_datetime(self, strdate):
"""
Parse input date string
This will try to correct timezone information if needed
:param strdate: string representing a timestamp
:return: a timestamp object
"""
tz = self.event.timezone # adapt to our event model
obj = parse_datetime(strdate)
if not obj:
raise TypeError
if obj.tzinfo is None:
# Adapt to new python timezone interface
obj = obj.replace(tzinfo=tz)
return obj
def _validate_availability(self, rawavail):
"""
Validate a raw availability instance input by making sure the relevant fields are present and can be parsed
The cleaned up values that are produced to test the validity of the input are stored in-place in the input
object for later usage in cleaning/parsing to availability objects
:param rawavail: object to validate/clean
"""
message = _("The submitted availability does not comply with the required format.")
if not isinstance(rawavail, dict):
raise forms.ValidationError(message)
rawavail.pop('id', None)
rawavail.pop('allDay', None)
if not set(rawavail.keys()) == {'start', 'end'}:
raise forms.ValidationError(message)
try:
rawavail['start'] = self._parse_datetime(rawavail['start'])
rawavail['end'] = self._parse_datetime(rawavail['end'])
# Adapt: Better error handling
except (TypeError, ValueError) as exc:
raise forms.ValidationError(
_("The submitted availability contains an invalid date.")
) from exc
timeframe_start = self.event.start # adapt to our event model
if rawavail['start'] < timeframe_start:
rawavail['start'] = timeframe_start
# add 1 day, not 24 hours, https://stackoverflow.com/a/25427822/2486196
timeframe_end = self.event.end # adapt to our event model
timeframe_end = timeframe_end + datetime.timedelta(days=1)
if rawavail['end'] > timeframe_end:
# If the submitted availability ended outside the event timeframe, fix it silently
rawavail['end'] = timeframe_end
def clean_availabilities(self):
"""
Turn raw availabilities into real availability objects
:return:
"""
data = self.cleaned_data.get('availabilities')
required = (
'availabilities' in self.fields and self.fields['availabilities'].required
)
if not data:
if required:
raise forms.ValidationError(_('Please fill in your availabilities!'))
return None
rawavailabilities = self._parse_availabilities_json(data)
availabilities = []
for rawavail in rawavailabilities:
self._validate_availability(rawavail)
availabilities.append(Availability(event_id=self.event.id, **rawavail))
if not availabilities and required:
raise forms.ValidationError(_('Please fill in your availabilities!'))
return availabilities
def _set_foreignkeys(self, instance, availabilities):
"""
Set the reference to `instance` in each given availability.
For example, set the availabilitiy.room_id to instance.id, in
case instance of type Room.
"""
reference_name = instance.availabilities.field.name + '_id'
for avail in availabilities:
setattr(avail, reference_name, instance.id)
def _replace_availabilities(self, instance, availabilities: [Availability]):
"""
Replace the existing list of availabilities belonging to an entity with a new, updated one
This will trigger a post_save signal for usage in constraint violation checking
:param instance: entity the availabilities belong to
:param availabilities: list of new availabilities
"""
with transaction.atomic():
# TODO: do not recreate objects unnecessarily, give the client the IDs, so we can track modifications and
# leave unchanged objects alone
instance.availabilities.all().delete()
Availability.objects.bulk_create(availabilities)
# Adaption:
# Trigger post save signal manually to make sure constraints are updated accordingly
# Doing this one time is sufficient, since this will nevertheless update all availability constraint
# violations of the corresponding AK
if len(availabilities) > 0:
post_save.send(Availability, instance=availabilities[0], created=True)
def save(self, *args, **kwargs):
"""
Override the saving method of the (model) form
"""
instance = super().save(*args, **kwargs)
availabilities = self.cleaned_data.get('availabilities')
if availabilities is not None:
self._set_foreignkeys(instance, availabilities)
self._replace_availabilities(instance, availabilities)
return instance # adapt to our forms
...@@ -21,8 +21,11 @@ zero_time = datetime.time(0, 0) ...@@ -21,8 +21,11 @@ zero_time = datetime.time(0, 0)
# remove serialization as requirements are not covered # remove serialization as requirements are not covered
# add translation # add translation
# add meta class # add meta class
# enable availabilites for AKs and AKCategories # enable availabilities for AKs and AKCategories
# add verbose names and help texts to model attributes # add verbose names and help texts to model attributes
# adapt or extemd documentation
class Availability(models.Model): class Availability(models.Model):
"""The Availability class models when people or rooms are available for. """The Availability class models when people or rooms are available for.
...@@ -31,6 +34,8 @@ class Availability(models.Model): ...@@ -31,6 +34,8 @@ class Availability(models.Model):
span multiple days, but due to our choice of input widget, it will span multiple days, but due to our choice of input widget, it will
usually only span a single day at most. usually only span a single day at most.
""" """
# pylint: disable=broad-exception-raised
event = models.ForeignKey( event = models.ForeignKey(
to=Event, to=Event,
related_name='availabilities', related_name='availabilities',
...@@ -96,10 +101,10 @@ class Availability(models.Model): ...@@ -96,10 +101,10 @@ class Availability(models.Model):
are the same. are the same.
""" """
return all( return all(
[ (
getattr(self, attribute, None) == getattr(other, attribute, None) getattr(self, attribute, None) == getattr(other, attribute, None)
for attribute in ['event', 'person', 'room', 'ak', 'ak_category', 'start', 'end'] for attribute in ['event', 'person', 'room', 'ak', 'ak_category', 'start', 'end']
] )
) )
@cached_property @cached_property
...@@ -231,6 +236,37 @@ class Availability(models.Model): ...@@ -231,6 +236,37 @@ class Availability(models.Model):
result = cls._pair_intersection(result, availset) result = cls._pair_intersection(result, availset)
return result return result
@property
def simplified(self):
"""
Get a simplified (only Weekday, hour and minute) string representation of an availability
:return: simplified string version
:rtype: str
"""
return (f'{self.start.astimezone(self.event.timezone).strftime("%a %H:%M")}-'
f'{self.end.astimezone(self.event.timezone).strftime("%a %H:%M")}')
@classmethod
def with_event_length(cls, event, person=None, room=None, ak=None, ak_category=None):
"""
Create an availability covering exactly the time between event start and event end.
Can e.g., be used to create default availabilities.
:param event: relevant event
:param person: person, if availability should be connected to a person
:param room: room, if availability should be connected to a room
:param ak: ak, if availability should be connected to a ak
:param ak_category: ak_category, if availability should be connected to a ak_category
:return: availability associated to the entity oder entities selected
:rtype: Availability
"""
timeframe_start = event.start # adapt to our event model
# add 1 day, not 24 hours, https://stackoverflow.com/a/25427822/2486196
timeframe_end = event.end # adapt to our event model
timeframe_end = timeframe_end + datetime.timedelta(days=1)
return Availability(start=timeframe_start, end=timeframe_end, event=event, person=person,
room=room, ak=ak, ak_category=ak_category)
class Meta: class Meta:
verbose_name = _('Availability') verbose_name = _('Availability')
verbose_name_plural = _('Availabilities') verbose_name_plural = _('Availabilities')
......
# This part of the code was adapted from pretalx (https://github.com/pretalx/pretalx)
# Copyright 2017-2019, Tobias Kunze
# Original Copyrights licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
# Documentation was mainly added by us, other changes are marked in the code
from django.utils import timezone
from rest_framework.fields import SerializerMethodField
from rest_framework.serializers import ModelSerializer
from AKModel.availability.models import Availability
class AvailabilitySerializer(ModelSerializer):
"""
REST Framework Serializer for Availability
"""
allDay = SerializerMethodField()
start = SerializerMethodField()
end = SerializerMethodField()
def get_allDay(self, obj): # pylint: disable=invalid-name
"""
Bridge between naming conventions of python and fullcalendar by providing the all_day field as allDay, too
"""
return obj.all_day
def get_start(self, obj):
"""
Get start timestamp
Use already localized strings in serialized field
(default would be UTC, but that would require heavy timezone calculation on client side)
"""
return timezone.localtime(obj.start, obj.event.timezone).strftime("%Y-%m-%dT%H:%M:%S")
def get_end(self, obj):
"""
Get end timestamp
Use already localized strings in serialized field
(default would be UTC, but that would require heavy timezone calculation on client side)
"""
return timezone.localtime(obj.end, obj.event.timezone).strftime("%Y-%m-%dT%H:%M:%S")
class Meta:
model = Availability
fields = ('id', 'start', 'end', 'allDay')
"""
Environment definitions
Needed for tex compilation
"""
import re
from django_tex.environment import environment
# Used to filter all very special UTF-8 chars that are probably not contained in the LaTeX fonts
# and would hence cause compilation errors
utf8_replace_pattern = re.compile('[^\u0000-\u206F]', re.UNICODE)
def latex_escape_utf8(value):
"""
Escape latex special chars and remove invalid utf-8 values
:param value: string to escape
:type value: str
:return: escaped string
:rtype: str
"""
return (utf8_replace_pattern.sub('', value).replace('&', r'\&').replace('_', r'\_').replace('#', r'\#').
replace('$', r'\$').replace('%', r'\%').replace('{', r'\{').replace('}', r'\}'))
def improved_tex_environment(**options):
"""
Encapsulate our improved latex environment for usage
"""
env = environment(**options)
env.filters.update({
'latex_escape_utf8': latex_escape_utf8,
})
return env
[
{
"model": "AKModel.event",
"pk": 1,
"fields": {
"name": "KIF 23",
"slug": "kif23",
"place": "Neuland",
"timezone": "Europe/Berlin",
"start": "2020-10-01T17:41:22Z",
"end": "2020-10-04T17:41:30Z",
"reso_deadline": "2020-10-03T10:00:00Z",
"interest_start": null,
"interest_end": null,
"public": true,
"active": false,
"plan_hidden": true,
"plan_published_at": null,
"base_url": "",
"wiki_export_template_name": "",
"default_slot": "2.00",
"contact_email": "dummy@eyample.org"
}
},
{
"model": "AKModel.event",
"pk": 2,
"fields": {
"name": "KIF 42",
"slug": "kif42",
"place": "Neuland noch neuer",
"timezone": "Europe/Berlin",
"start": "2020-11-06T17:51:26Z",
"end": "2020-11-10T17:51:27Z",
"reso_deadline": "2020-11-08T17:51:42Z",
"interest_start": null,
"interest_end": null,
"public": true,
"active": true,
"plan_hidden": false,
"plan_published_at": "2022-12-01T21:50:01Z",
"base_url": "",
"wiki_export_template_name": "",
"default_slot": "2.00",
"contact_email": "dummy@example.org"
}
},
{
"model": "AKModel.akowner",
"pk": 1,
"fields": {
"name": "a",
"slug": "a",
"institution": "Uni X",
"link": "",
"event": 2
}
},
{
"model": "AKModel.akowner",
"pk": 2,
"fields": {
"name": "b",
"slug": "b",
"institution": "Hochschule Y",
"link": "",
"event": 2
}
},
{
"model": "AKModel.akowner",
"pk": 3,
"fields": {
"name": "c",
"slug": "c",
"institution": "",
"link": "",
"event": 1
}
},
{
"model": "AKModel.akowner",
"pk": 4,
"fields": {
"name": "d",
"slug": "d",
"institution": "",
"link": "",
"event": 1
}
},
{
"model": "AKModel.akcategory",
"pk": 1,
"fields": {
"name": "Spa▀",
"color": "275246",
"description": "",
"present_by_default": true,
"event": 1
}
},
{
"model": "AKModel.akcategory",
"pk": 2,
"fields": {
"name": "Ernst",
"color": "234567",
"description": "",
"present_by_default": true,
"event": 1
}
},
{
"model": "AKModel.akcategory",
"pk": 3,
"fields": {
"name": "Spa▀/Kultur",
"color": "333333",
"description": "",
"present_by_default": true,
"event": 2
}
},
{
"model": "AKModel.akcategory",
"pk": 4,
"fields": {
"name": "Inhalt",
"color": "456789",
"description": "",
"present_by_default": true,
"event": 2
}
},
{
"model": "AKModel.akcategory",
"pk": 5,
"fields": {
"name": "Meta",
"color": "111111",
"description": "",
"present_by_default": true,
"event": 2
}
},
{
"model": "AKModel.aktrack",
"pk": 1,
"fields": {
"name": "Track 1",
"color": "",
"event": 2
}
},
{
"model": "AKModel.akrequirement",
"pk": 1,
"fields": {
"name": "Beamer",
"event": 1
}
},
{
"model": "AKModel.akrequirement",
"pk": 2,
"fields": {
"name": "Internet",
"event": 1
}
},
{
"model": "AKModel.akrequirement",
"pk": 3,
"fields": {
"name": "BBB",
"event": 2
}
},
{
"model": "AKModel.akrequirement",
"pk": 4,
"fields": {
"name": "Mumble",
"event": 2
}
},
{
"model": "AKModel.akrequirement",
"pk": 5,
"fields": {
"name": "Matrix",
"event": 2
}
},
{
"model": "AKModel.aktype",
"pk": 1,
"fields": {
"name": "Input",
"event": 2
}
},
{
"model": "AKModel.historicalak",
"pk": 1,
"fields": {
"id": 1,
"name": "Test AK Inhalt",
"short_name": "test1",
"description": "",
"link": "",
"protocol_link": "",
"reso": false,
"present": true,
"notes": "",
"category": 4,
"track": null,
"event": 2,
"history_date": "2021-05-04T10:28:59.265Z",
"history_change_reason": null,
"history_type": "+",
"history_user": null
}
},
{
"model": "AKModel.historicalak",
"pk": 2,
"fields": {
"id": 1,
"name": "Test AK Inhalt",
"short_name": "test1",
"description": "",
"link": "",
"protocol_link": "",
"reso": false,
"present": true,
"notes": "",
"category": 4,
"track": null,
"event": 2,
"history_date": "2021-05-04T10:28:59.305Z",
"history_change_reason": null,
"history_type": "~",
"history_user": null
}
},
{
"model": "AKModel.historicalak",
"pk": 3,
"fields": {
"id": 2,
"name": "Test AK Meta",
"short_name": "test2",
"description": "",
"link": "",
"protocol_link": "",
"reso": false,
"present": null,
"notes": "",
"category": 5,
"track": null,
"event": 2,
"history_date": "2021-05-04T10:29:40.296Z",
"history_change_reason": null,
"history_type": "+",
"history_user": null
}
},
{
"model": "AKModel.historicalak",
"pk": 4,
"fields": {
"id": 2,
"name": "Test AK Meta",
"short_name": "test2",
"description": "",
"link": "",
"protocol_link": "",
"reso": false,
"present": null,
"notes": "",
"category": 5,
"track": null,
"event": 2,
"history_date": "2021-05-04T10:29:40.355Z",
"history_change_reason": null,
"history_type": "~",
"history_user": null
}
},
{
"model": "AKModel.historicalak",
"pk": 5,
"fields": {
"id": 3,
"name": "AK Wish",
"short_name": "wish1",
"description": "Description of my Wish",
"link": "",
"protocol_link": "",
"reso": false,
"present": null,
"notes": "We need to find a volunteer first...",
"category": 3,
"track": null,
"event": 2,
"history_date": "2021-05-04T10:30:59.469Z",
"history_change_reason": null,
"history_type": "+",
"history_user": null
}
},
{
"model": "AKModel.historicalak",
"pk": 6,
"fields": {
"id": 3,
"name": "AK Wish",
"short_name": "wish1",
"description": "Description of my Wish",
"link": "",
"protocol_link": "",
"reso": false,
"present": null,
"notes": "We need to find a volunteer first...",
"category": 3,
"track": null,
"event": 2,
"history_date": "2021-05-04T10:30:59.509Z",
"history_change_reason": null,
"history_type": "~",
"history_user": null
}
},
{
"model": "AKModel.historicalak",
"pk": 7,
"fields": {
"id": 2,
"name": "Test AK Meta",
"short_name": "test2",
"description": "",
"link": "",
"protocol_link": "",
"reso": false,
"present": null,
"notes": "",
"category": 5,
"track": 1,
"event": 2,
"history_date": "2022-12-02T12:27:14.277Z",
"history_change_reason": null,
"history_type": "~",
"history_user": null
}
},
{
"model": "AKModel.ak",
"pk": 1,
"fields": {
"name": "Test AK Inhalt",
"short_name": "test1",
"description": "",
"link": "",
"protocol_link": "",
"category": 4,
"track": null,
"reso": false,
"present": true,
"notes": "",
"interest": -1,
"interest_counter": 0,
"include_in_export": false,
"event": 2,
"owners": [
1
],
"requirements": [
3
],
"conflicts": [],
"prerequisites": []
}
},
{
"model": "AKModel.ak",
"pk": 2,
"fields": {
"name": "Test AK Meta",
"short_name": "test2",
"description": "",
"link": "",
"protocol_link": "",
"category": 5,
"track": 1,
"reso": false,
"present": null,
"notes": "",
"interest": -1,
"interest_counter": 0,
"event": 2,
"owners": [
2
],
"requirements": [],
"conflicts": [],
"prerequisites": []
}
},
{
"model": "AKModel.ak",
"pk": 3,
"fields": {
"name": "AK Wish",
"short_name": "wish1",
"description": "Description of my Wish",
"link": "",
"protocol_link": "",
"category": 3,
"track": null,
"reso": false,
"present": null,
"notes": "We need to find a volunteer first...",
"interest": -1,
"interest_counter": 0,
"event": 2,
"owners": [],
"requirements": [
4
],
"conflicts": [
1
],
"prerequisites": [
2
]
}
},
{
"model": "AKModel.room",
"pk": 1,
"fields": {
"name": "Testraum",
"location": "BBB",
"capacity": -1,
"event": 2,
"properties": [
3
]
}
},
{
"model": "AKModel.room",
"pk": 2,
"fields": {
"name": "Testraum 2",
"location": "",
"capacity": 30,
"event": 2,
"properties": []
}
},
{
"model": "AKModel.akslot",
"pk": 1,
"fields": {
"ak": 1,
"room": 2,
"start": "2020-11-06T18:30:00Z",
"duration": "2.00",
"fixed": false,
"event": 2,
"updated": "2022-12-02T12:23:11.856Z"
}
},
{
"model": "AKModel.akslot",
"pk": 2,
"fields": {
"ak": 2,
"room": 1,
"start": "2020-11-08T12:30:00Z",
"duration": "2.00",
"fixed": false,
"event": 2,
"updated": "2022-12-02T12:23:18.279Z"
}
},
{
"model": "AKModel.akslot",
"pk": 3,
"fields": {
"ak": 3,
"room": null,
"start": null,
"duration": "1.50",
"fixed": false,
"event": 2,
"updated": "2021-05-04T10:30:59.523Z"
}
},
{
"model": "AKModel.akslot",
"pk": 4,
"fields": {
"ak": 3,
"room": null,
"start": null,
"duration": "3.00",
"fixed": false,
"event": 2,
"updated": "2021-05-04T10:30:59.528Z"
}
},
{
"model": "AKModel.akslot",
"pk": 5,
"fields": {
"ak": 1,
"room": null,
"start": null,
"duration": "2.00",
"fixed": false,
"event": 2,
"updated": "2022-12-02T12:23:11.856Z"
}
},
{
"model": "AKModel.constraintviolation",
"pk": 1,
"fields": {
"type": "soa",
"level": 10,
"event": 2,
"ak_owner": null,
"room": null,
"requirement": null,
"category": null,
"comment": "",
"timestamp": "2022-12-02T12:23:11.875Z",
"manually_resolved": false,
"aks": [
1
],
"ak_slots": [
1
]
}
},
{
"model": "AKModel.constraintviolation",
"pk": 2,
"fields": {
"type": "rng",
"level": 10,
"event": 2,
"ak_owner": null,
"room": 2,
"requirement": 3,
"category": null,
"comment": "",
"timestamp": "2022-12-02T12:23:11.890Z",
"manually_resolved": false,
"aks": [
1
],
"ak_slots": [
1
]
}
},
{
"model": "AKModel.constraintviolation",
"pk": 3,
"fields": {
"type": "soa",
"level": 10,
"event": 2,
"ak_owner": null,
"room": null,
"requirement": null,
"category": null,
"comment": "",
"timestamp": "2022-12-02T12:23:18.301Z",
"manually_resolved": false,
"aks": [
2
],
"ak_slots": [
2
]
}
},
{
"model": "AKModel.availability",
"pk": 1,
"fields": {
"event": 2,
"person": null,
"room": null,
"ak": 1,
"ak_category": null,
"start": "2020-11-07T08:00:00Z",
"end": "2020-11-07T18:00:00Z"
}
},
{
"model": "AKModel.availability",
"pk": 2,
"fields": {
"event": 2,
"person": null,
"room": null,
"ak": 1,
"ak_category": null,
"start": "2020-11-09T10:00:00Z",
"end": "2020-11-09T16:30:00Z"
}
},
{
"model": "AKModel.availability",
"pk": 3,
"fields": {
"event": 2,
"person": null,
"room": 1,
"ak": null,
"ak_category": null,
"start": "2020-11-06T17:51:26Z",
"end": "2020-11-10T23:00:00Z"
}
},
{
"model": "AKModel.availability",
"pk": 4,
"fields": {
"event": 2,
"person": null,
"room": 2,
"ak": null,
"ak_category": null,
"start": "2020-11-06T17:51:26Z",
"end": "2020-11-06T21:00:00Z"
}
},
{
"model": "AKModel.availability",
"pk": 5,
"fields": {
"event": 2,
"person": null,
"room": 2,
"ak": null,
"ak_category": null,
"start": "2020-11-08T15:30:00Z",
"end": "2020-11-08T19:30:00Z"
}
},
{
"model": "AKModel.availability",
"pk": 6,
"fields": {
"event": 2,
"person": null,
"room": 2,
"ak": null,
"ak_category": null,
"start": "2020-11-07T18:30:00Z",
"end": "2020-11-07T21:30:00Z"
}
}
]
"""
Central and admin forms
"""
import csv
import io
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, 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']
widgets = {
'plan_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
fields = "__all__"
exclude = ['plan_published_at']
widgets = {
'name': forms.HiddenInput(),
'slug': forms.HiddenInput(),
'timezone': forms.HiddenInput(),
'active': forms.HiddenInput(),
'start': DateTimeInput(),
'end': DateTimeInput(),
'interest_start': DateTimeInput(),
'interest_end': DateTimeInput(),
'reso_deadline': DateTimeInput(),
'plan_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"),
help_text=_("You can choose what to copy in the next step")
)
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,
label=_("Copy ak categories"),
required=False,
)
import_requirements = forms.ModelMultipleChoiceField(
queryset=AKRequirement.objects.all(),
widget=forms.CheckboxSelectMultiple,
label=_("Copy ak requirements"),
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):
super().__init__(data, files, auto_id, prefix, initial, error_class, label_suffix, empty_permitted, field_order,
use_required_attribute, renderer)
self.fields["import_categories"].queryset = self.fields["import_categories"].queryset.filter(
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,
label=_("Copy dashboard buttons"),
required=False,
)
class NewEventWizardActivateForm(forms.ModelForm):
"""
Wizard form to activate the newly created event
"""
class Meta:
fields = ["active"]
model = Event
class AdminIntermediateForm(forms.Form):
"""
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?"))
presentation_mode = forms.TypedChoiceField(
initial=False,
label=_("Presentation only?"),
widget=forms.RadioSelect,
choices=((True, _('Yes')), (False, _('No'))),
coerce=lambda x: x == "True",
help_text=_("Restrict AKs to those that asked for chance to be presented?"))
wish_notes = forms.TypedChoiceField(
initial=False,
label=_("Space for notes in wishes?"),
widget=forms.RadioSelect,
choices=((True, _('Yes')), (False, _('No'))),
coerce=lambda x: x == "True",
help_text=_("Create symbols indicating space to note down owners and timeslots for wishes, e.g., to be filled "
"out on a touch screen while presenting?"))
class DefaultSlotEditorForm(AdminIntermediateForm):
"""
Form for default slot editor
"""
availabilities = forms.CharField(
label=_('Default Slots'),
help_text=_(
'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.'
),
widget=forms.TextInput(attrs={'class': 'availabilities-editor-data'}),
required=True,
)
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", '
'"capacity", and "url" for online/hybrid rooms. Delimiter: Semicolon'),
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=";")
if "name" not in rooms_raw_dict.fieldnames:
raise forms.ValidationError(_("CSV must contain a name column"))
return rooms_raw_dict
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',
'location',
'capacity',
'event',
]
class RoomFormWithAvailabilities(AvailabilitiesFormMixin, RoomForm):
"""
Room (update) form including handling of availabilities, extends :class:`RoomForm`
"""
class Meta:
model = Room
fields = ['name',
'location',
'capacity',
'properties',
'event',
]
widgets = {
'properties': forms.CheckboxSelectMultiple,
}
def __init__(self, *args, **kwargs):
# Init availability mixin
kwargs['initial'] = {}
super().__init__(*args, **kwargs)
self.initial = {**self.initial, **kwargs['initial']}
# Filter possible values for m2m when event is specified
if hasattr(self.instance, "event") and self.instance.event is not None:
self.fields["properties"].queryset = AKRequirement.objects.filter(event=self.instance.event)
...@@ -2,7 +2,7 @@ msgid "" ...@@ -2,7 +2,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: 2019-10-24 22:48+0000\n" "POT-Creation-Date: 2025-03-03 20:47+0100\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"
...@@ -11,406 +11,1377 @@ msgstr "" ...@@ -11,406 +11,1377 @@ 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"
#: availability.py:38 models.py:25 models.py:47 models.py:141 models.py:190 #: AKModel/admin.py:88 AKModel/admin.py:98
#: models.py:222 models.py:248 #: 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
#: AKModel/templates/admin/ak_index.html:15
msgid "Status"
msgstr "Status"
#: AKModel/admin.py:100
msgid "Toggle plan visibility"
msgstr "Plansichtbarkeit ändern"
#: AKModel/admin.py:112 AKModel/admin.py:123 AKModel/views/manage.py:138
msgid "Publish plan"
msgstr "Plan veröffentlichen"
#: AKModel/admin.py:115 AKModel/admin.py:131 AKModel/views/manage.py:151
msgid "Unpublish plan"
msgstr "Plan verbergen"
#: AKModel/admin.py:170 AKModel/models.py:396 AKModel/models.py:736
#: AKModel/templates/admin/AKModel/aks_by_user.html:12
#: AKModel/templates/admin/AKModel/status/event_aks.html:10
#: AKModel/views/manage.py:73 AKModel/views/status.py:102
msgid "AKs"
msgstr "AKs"
#: AKModel/admin.py:236
msgid "Wish"
msgstr "AK-Wunsch"
#: AKModel/admin.py:242
msgid "Is wish"
msgstr "Ist ein Wunsch"
#: AKModel/admin.py:243
msgid "Is not a wish"
msgstr "Ist kein Wunsch"
#: AKModel/admin.py:303
msgid "Export to wiki syntax"
msgstr "In Wiki-Syntax exportieren"
#: AKModel/admin.py:320
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:335 AKModel/views/ak.py:99
msgid "Reset interest in AKs"
msgstr "Interesse an AKs zurücksetzen"
#: AKModel/admin.py:345 AKModel/views/ak.py:114
msgid "Reset AKs' interest counters"
msgstr "Interessenszähler der AKs zurücksetzen"
#: AKModel/admin.py:444 AKModel/admin.py:458
msgid "AK Details"
msgstr "AK-Details"
#: AKModel/admin.py:520 AKModel/views/manage.py:99
msgid "Mark Constraint Violations as manually resolved"
msgstr "Markiere Constraintverletzungen als manuell behoben"
#: AKModel/admin.py:529 AKModel/views/manage.py:112
msgid "Set Constraint Violations to level \"violation\""
msgstr "Constraintverletzungen auf Level \"Violation\" setzen"
#: AKModel/admin.py:538 AKModel/views/manage.py:125
msgid "Set Constraint Violations to level \"warning\""
msgstr "Constraintverletzungen auf Level \"Warning\" setzen"
#: AKModel/admin.py:585
msgid "Activate selected users"
msgstr "Ausgewählte Benutzer*innen aktivieren"
#: AKModel/admin.py:594
msgid "The selected users have been activated."
msgstr "Benutzer*innen aktiviert"
#: AKModel/admin.py:596
msgid "Deactivate selected users"
msgstr "Ausgewählte Benutzer*innen deaktivieren"
#: AKModel/admin.py:605
msgid "The selected users have been deactivated."
msgstr "Benutzer*innen deaktiviert"
#: AKModel/availability/forms.py:25 AKModel/availability/models.py:271
msgid "Availability"
msgstr "Verfügbarkeit"
#: 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."
msgstr ""
"Klicken und ziehen um die Verfügbarkeiten während des Events zu markieren. "
"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: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:137
msgid "The submitted availability contains an invalid date."
msgstr "Die eingegebene Verfügbarkeit enthält ein ungültiges Datum."
#: 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:43 AKModel/models.py:71 AKModel/models.py:187
#: AKModel/models.py:264 AKModel/models.py:283 AKModel/models.py:309
#: AKModel/models.py:328 AKModel/models.py:386 AKModel/models.py:546
#: AKModel/models.py:585 AKModel/models.py:675 AKModel/models.py:732
#: AKModel/models.py:923
msgid "Event" msgid "Event"
msgstr "Event" msgstr "Event"
#: availability.py:39 models.py:48 models.py:142 models.py:191 models.py:223 #: AKModel/availability/models.py:44 AKModel/models.py:188
#: models.py:249 #: AKModel/models.py:265 AKModel/models.py:284 AKModel/models.py:310
#: AKModel/models.py:329 AKModel/models.py:387 AKModel/models.py:547
#: AKModel/models.py:586 AKModel/models.py:676 AKModel/models.py:733
#: AKModel/models.py:924
msgid "Associated event" msgid "Associated event"
msgstr "Zugehöriges Event" msgstr "Zugehöriges Event"
#: availability.py:47 #: AKModel/availability/models.py:52
msgid "Person" msgid "Person"
msgstr "Person" msgstr "Person"
#: availability.py:48 #: AKModel/availability/models.py:53
msgid "Person whose availability this is" msgid "Person whose availability this is"
msgstr "Person deren Verfügbarkeit hier abgebildet wird" msgstr "Person deren Verfügbarkeit hier abgebildet wird"
#: availability.py:56 models.py:226 models.py:241 #: AKModel/availability/models.py:61 AKModel/models.py:550
#: AKModel/models.py:575 AKModel/models.py:742
msgid "Room" msgid "Room"
msgstr "Raum" msgstr "Raum"
#: availability.py:57 #: AKModel/availability/models.py:62
msgid "Room whose availability this is" msgid "Room whose availability this is"
msgstr "Raum dessen Verfügbarkeit hier abgebildet wird" msgstr "Raum dessen Verfügbarkeit hier abgebildet wird"
#: availability.py:65 models.py:194 models.py:240 #: AKModel/availability/models.py:70 AKModel/models.py:395
#: AKModel/models.py:574 AKModel/models.py:670
msgid "AK" msgid "AK"
msgstr "AK" msgstr "AK"
#: availability.py:66 #: AKModel/availability/models.py:71
#, fuzzy
#| msgid "Availabilities"
msgid "AK whose availability this is" msgid "AK whose availability this is"
msgstr "Verfügbarkeiten" msgstr "Verfügbarkeiten"
#: availability.py:74 models.py:99 #: AKModel/availability/models.py:79 AKModel/models.py:268
#: AKModel/models.py:748
msgid "AK Category" msgid "AK Category"
msgstr "AK Kategorie" msgstr "AK-Kategorie"
#: availability.py:75 #: AKModel/availability/models.py:80
msgid "AK Category whose availability this is" msgid "AK Category whose availability this is"
msgstr "AK Kategorie dessen Verfügbarkeit hier abgebildet wird" msgstr "AK-Kategorie, deren Verfügbarkeit hier abgebildet wird"
#: availability.py:235
msgid "Availability"
msgstr "Verfügbarkeit"
#: availability.py:236 #: AKModel/availability/models.py:272
msgid "Availabilities" msgid "Availabilities"
msgstr "Verfügbarkeiten" msgstr "Verfügbarkeiten"
#: models.py:12 models.py:94 models.py:110 models.py:125 models.py:139 #: AKModel/forms.py:78
#: models.py:156 models.py:215 msgid "Copy ak requirements and ak categories of existing event"
msgstr "AK-Anforderungen und AK-Kategorien eines existierenden Events kopieren"
#: 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:93
msgid "Copy ak categories"
msgstr "AK-Kategorien kopieren"
#: AKModel/forms.py:100
msgid "Copy ak requirements"
msgstr "AK-Anforderungen kopieren"
#: 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:174
msgid "# next AKs"
msgstr "# nächste AKs"
#: 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:178
msgid "Presentation only?"
msgstr "Nur Vorstellung?"
#: AKModel/forms.py:180 AKModel/forms.py:187
msgid "Yes"
msgstr "Ja"
#: AKModel/forms.py:180 AKModel/forms.py:187
msgid "No"
msgstr "Nein"
#: AKModel/forms.py:182
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:185
msgid "Space for notes in wishes?"
msgstr "Platz für Notizen bei den Wünschen?"
#: AKModel/forms.py:189
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?"
msgstr ""
"Symbole anlegen, die Raum zum Notieren von Leitungen und Zeitslots "
"fürWünsche markieren, z.B. um während der Präsentation auf einem Touchscreen "
"ausgefüllt zu werden?"
#: AKModel/forms.py:198 AKModel/models.py:917
msgid "Default Slots"
msgstr "Standardslots"
#: AKModel/forms.py:200
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."
msgstr ""
"Klicken und ziehen um Standardslots hinzuzufügen, doppelt klicken um "
"Einträge zu löschen. Oder Start- und End-Eingabe verwenden, um der "
"Kalenderansicht neue Einträge hinzuzufügen."
#: AKModel/forms.py:216
msgid "New rooms"
msgstr "Neue Räume"
#: AKModel/forms.py:217
msgid ""
"Enter room details in CSV format. Required colum is \"name\", optional "
"colums are \"location\", \"capacity\", and \"url\" for online/hybrid rooms. "
"Delimiter: Semicolon"
msgstr ""
"Raumdetails im CSV-Format eingeben. Benötigte Spalte ist \"name\", optionale "
"Spalten sind \"location\", \"capacity\", und \"url\" for Online-/"
"HybridräumeTrennzeichen: Semikolon"
#: AKModel/forms.py:223
msgid "Default availabilities?"
msgstr "Standardverfügbarkeiten?"
#: AKModel/forms.py:224
msgid "Create default availabilities for all rooms?"
msgstr "Standardverfügbarkeiten für alle Räume anlegen?"
#: AKModel/forms.py:240
msgid "CSV must contain a name column"
msgstr "CSV muss eine name-Spalte enthalten"
#: AKModel/metaviews/admin.py:156 AKModel/models.py:40
msgid "Start"
msgstr "Start"
#: AKModel/metaviews/admin.py:157
msgid "Settings"
msgstr "Einstellungen"
#: AKModel/metaviews/admin.py:158
msgid "Event created, Prepare Import"
msgstr "Event angelegt, Import vorbereiten"
#: AKModel/metaviews/admin.py:159
msgid "Import categories & requirements"
msgstr "Kategorien & Anforderungen kopieren"
#: AKModel/metaviews/admin.py:160
msgid "Activate?"
msgstr "Aktivieren?"
#: AKModel/metaviews/admin.py:161
#: AKModel/templates/admin/AKModel/event_wizard/activate.html:30
msgid "Finish"
msgstr "Abschluss"
#: AKModel/models.py:21
msgid "May not contain quotation marks"
msgstr "Darf keine Anführungszeichen enthalten"
#: AKModel/models.py:24
msgid "Must contain at least one letter or digit"
msgstr "Muss mindestens einen Buchstaben oder eine Ziffer enthalten"
#: AKModel/models.py:31 AKModel/models.py:256 AKModel/models.py:280
#: AKModel/models.py:307 AKModel/models.py:326 AKModel/models.py:344
#: AKModel/models.py:536
msgid "Name" msgid "Name"
msgstr "Name" msgstr "Name"
#: models.py:13 #: AKModel/models.py:32
msgid "Name or iteration of the event" msgid "Name or iteration of the event"
msgstr "Name oder Iteration des Events" msgstr "Name oder Iteration des Events"
#: models.py:14 #: AKModel/models.py:33
#, fuzzy
#| msgid "Short Name"
msgid "Short Form" msgid "Short Form"
msgstr "Kurzer Name" msgstr "Kurzer Name"
#: models.py:15 #: AKModel/models.py:34
msgid "Short name of letters/numbers/dots/dashes/underscores used in URLs." msgid "Short name of letters/numbers/dots/dashes/underscores used in URLs."
msgstr "" msgstr ""
"Kurzname bestehend aus Buchstaben, Nummern, Punkten und Unterstrichen zur "
"Nutzung in URLs"
#: models.py:16 #: AKModel/models.py:36
msgid "Start" msgid "Place"
msgstr "Start" msgstr "Ort"
#: models.py:16 #: AKModel/models.py:37
msgid "City etc. the event takes place in"
msgstr "Stadt o.ä. in der das Event stattfindet"
#: AKModel/models.py:39
msgid "Time Zone"
msgstr "Zeitzone"
#: AKModel/models.py:39
msgid "Time Zone where this event takes place in"
msgstr "Zeitzone in der das Event stattfindet"
#: AKModel/models.py:40
msgid "Time the event begins" msgid "Time the event begins"
msgstr "Zeit zu der das Event beginnt" msgstr "Zeit zu der das Event beginnt"
#: models.py:17 #: AKModel/models.py:41
msgid "End" msgid "End"
msgstr "Ende" msgstr "Ende"
#: models.py:17 #: AKModel/models.py:41
msgid "Time the event ends" msgid "Time the event ends"
msgstr "Zeit zu der das Event endet" msgstr "Zeit zu der das Event endet"
#: models.py:18 #: AKModel/models.py:42
msgid "Place" msgid "Resolution Deadline"
msgstr "Ort" msgstr "Resolutionsdeadline"
#: models.py:19 #: AKModel/models.py:43
msgid "City etc. the event takes place in" msgid "When should AKs with intention to submit a resolution be done?"
msgstr "Stadt o.ä. in der das Event stattfindet" msgstr "Wann sollen AKs mit Resolutionsabsicht stattgefunden haben?"
#: AKModel/models.py:45
msgid "Interest Window Start"
msgstr "Beginn Interessensbekundung"
#: AKModel/models.py:47
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:49
msgid "Interest Window End"
msgstr "Ende Interessensbekundung"
#: models.py:20 #: AKModel/models.py:50
msgid "Closing time for expression of interest."
msgstr "Öffnungszeitpunkt für die Angabe von Interesse an AKs."
#: AKModel/models.py:52
msgid "Public event"
msgstr "Öffentliches Event"
#: AKModel/models.py:53
msgid "Show this event on overview page."
msgstr "Zeige dieses Event auf der Übersichtseite an"
#: AKModel/models.py:55
msgid "Active State" msgid "Active State"
msgstr "Aktiver Status" msgstr "Aktiver Status"
#: models.py:20 #: AKModel/models.py:55
msgid "Marks currently active events" msgid "Marks currently active events"
msgstr "Markiert aktuell aktive Events" msgstr "Markiert aktuell aktive Events"
#: models.py:22 #: AKModel/models.py:56
msgid "Plan Hidden"
msgstr "Plan verborgen"
#: AKModel/models.py:56
msgid "Hides plan for non-staff users"
msgstr "Verbirgt den Plan für Nutzer*innen ohne erweiterte Rechte"
#: AKModel/models.py:58
msgid "Plan published at"
msgstr "Plan veröffentlicht am/um"
#: AKModel/models.py:59
msgid "Timestamp at which the plan was published"
msgstr "Zeitpunkt, zu dem der Plan veröffentlicht wurde"
#: AKModel/models.py:61
msgid "Base URL" msgid "Base URL"
msgstr "URL-Prefix" msgstr "URL-Prefix"
#: models.py:22 #: AKModel/models.py:61
msgid "Prefix for wiki link construction" msgid "Prefix for wiki link construction"
msgstr "Prefix für die automatische Generierung von Wiki-Links" msgstr "Prefix für die automatische Generierung von Wiki-Links"
#: models.py:26 #: AKModel/models.py:62
msgid "Wiki Export Template Name"
msgstr "Wiki-Export Templatename"
#: AKModel/models.py:63
msgid "Default Slot Length"
msgstr "Standardslotlänge"
#: AKModel/models.py:64
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:66
msgid "Contact email address"
msgstr "E-Mail Kontaktadresse"
#: AKModel/models.py:67
msgid ""
"An email address that is displayed on every page and can be used for all "
"kinds of questions"
msgstr ""
"Eine Mailadresse die auf jeder Seite angezeigt wird und für alle Arten von "
"Fragen genutzt werden kann"
#: AKModel/models.py:72
msgid "Events" msgid "Events"
msgstr "Events" msgstr "Events"
#: models.py:40 #: AKModel/models.py:180
msgid "Nickname" msgid "Nickname"
msgstr "Spitzname" msgstr "Spitzname"
#: models.py:40 #: AKModel/models.py:182
msgid "Name to identify an AK owner by" msgid "Name to identify an AK owner by"
msgstr "Name durch den eine AK Leitung identifiziert wird" msgstr "Name, durch den eine AK-Leitung identifiziert wird"
#: models.py:41 #: AKModel/models.py:183
msgid "Slug" msgid "Slug"
msgstr "Slug" msgstr "Slug"
#: models.py:42 #: AKModel/models.py:183
msgid "Slug for URL generation" msgid "Slug for URL generation"
msgstr "Slug für URL-Generierung" msgstr "Slug für URL-Generierung"
#: models.py:43 #: AKModel/models.py:184
msgid "E-Mail Address"
msgstr "E-Mail Adresse"
#: models.py:43
msgid "Contact mail"
msgstr "Kontakt E-Mail"
#: models.py:44
msgid "Institution" msgid "Institution"
msgstr "Instutution" msgstr "Instutution"
#: models.py:44 #: AKModel/models.py:184
msgid "Uni etc." msgid "Uni etc."
msgstr "Universität o.ä." msgstr "Universität o.ä."
#: models.py:45 models.py:165 #: AKModel/models.py:185 AKModel/models.py:355
msgid "Web Link" msgid "Web Link"
msgstr "Internet Link" msgstr "Internet Link"
#: models.py:45 #: AKModel/models.py:185
msgid "Link to Homepage" msgid "Link to Homepage"
msgstr "Link zu Homepage oder Webseite" msgstr "Link zu Homepage oder Webseite"
#: models.py:51 #: AKModel/models.py:191 AKModel/models.py:741
msgid "AK Owner" msgid "AK Owner"
msgstr "AK Leitung" msgstr "AK-Leitung"
#: models.py:52 #: AKModel/models.py:192
msgid "AK Owners" msgid "AK Owners"
msgstr "AK Leitungen" msgstr "AK-Leitungen"
#: models.py:94 #: AKModel/models.py:256
msgid "Name of the AK Category" msgid "Name of the AK Category"
msgstr "Name des AK Kategorie" msgstr "Name der AK-Kategorie"
#: models.py:95 models.py:111 #: AKModel/models.py:257 AKModel/models.py:281
msgid "Color" msgid "Color"
msgstr "Farbe" msgstr "Farbe"
#: models.py:95 models.py:111 #: AKModel/models.py:257 AKModel/models.py:281
msgid "Color for displaying" msgid "Color for displaying"
msgstr "Farbe für die Anzeige" msgstr "Farbe für die Anzeige"
#: models.py:96 models.py:159 #: AKModel/models.py:258 AKModel/models.py:349
msgid "Description" msgid "Description"
msgstr "Beschreibung" msgstr "Beschreibung"
#: models.py:96 #: AKModel/models.py:259
msgid "Short description of this AK Category" msgid "Short description of this AK Category"
msgstr "Beschreibung der AK-Kategorie" msgstr "Beschreibung der AK-Kategorie"
#: models.py:100 #: AKModel/models.py:260
msgid "Present by default"
msgstr "Defaultmäßig präsentieren"
#: AKModel/models.py:261
msgid ""
"Present AKs of this category by default if AK owner did not specify whether "
"this AK should be presented?"
msgstr ""
"AKs dieser Kategorie standardmäßig vorstellen, wenn die Leitungen das für "
"ihren AK nicht explizit spezifiziert haben?"
#: AKModel/models.py:269
msgid "AK Categories" msgid "AK Categories"
msgstr "AK Kategorien" msgstr "AK-Kategorien"
#: models.py:110 #: AKModel/models.py:280
msgid "Name of the AK Track" msgid "Name of the AK Track"
msgstr "Name des AK Tracks" msgstr "Name des AK-Tracks"
#: models.py:114 #: AKModel/models.py:287
msgid "AK Track" msgid "AK Track"
msgstr "AK Track" msgstr "AK-Track"
#: models.py:115 #: AKModel/models.py:288
msgid "AK Tracks" msgid "AK Tracks"
msgstr "AK Tracks" msgstr "AK-Tracks"
#: models.py:125 #: AKModel/models.py:307
msgid "Name of the AK Tag"
msgstr "Name das AK Tags"
#: models.py:128
msgid "AK Tag"
msgstr "AK Tag"
#: models.py:129
msgid "AK Tags"
msgstr "AK Tags"
#: models.py:139
msgid "Name of the Requirement" msgid "Name of the Requirement"
msgstr "Name der Anforderung" msgstr "Name der Anforderung"
#: models.py:145 #: AKModel/models.py:313 AKModel/models.py:745
msgid "AK Requirement" msgid "AK Requirement"
msgstr "AK Anforderung" msgstr "AK-Anforderung"
#: models.py:146 #: AKModel/models.py:314
msgid "AK Requirements" msgid "AK Requirements"
msgstr "AK Anforderungen" msgstr "AK-Anforderungen"
#: AKModel/models.py:326
msgid "Name describing the type"
msgstr "Name, der den Typ beschreibt"
#: models.py:156 #: AKModel/models.py:332
msgid "AK Type"
msgstr "AK Typ"
#: AKModel/models.py:333
msgid "AK Types"
msgstr "AK-Typen"
#: AKModel/models.py:344
msgid "Name of the AK" msgid "Name of the AK"
msgstr "Name des AKs" msgstr "Name des AKs"
#: models.py:157 #: AKModel/models.py:346
msgid "Short Name" msgid "Short Name"
msgstr "Kurzer Name" msgstr "Kurzer Name"
#: models.py:158 #: AKModel/models.py:348
msgid "Name displayed in the schedule" msgid "Name displayed in the schedule"
msgstr "Name zur Anzeige im AK Plan" msgstr "Name zur Anzeige im AK-Plan"
#: models.py:159 #: AKModel/models.py:349
msgid "Description of the AK" msgid "Description of the AK"
msgstr "Beschreibung des AKs" msgstr "Beschreibung des AKs"
#: models.py:161 #: AKModel/models.py:351
msgid "Owners" msgid "Owners"
msgstr "Leitungen" msgstr "Leitungen"
#: models.py:162 #: AKModel/models.py:352
msgid "Those organizing the AK" msgid "Those organizing the AK"
msgstr "Menschen, die den AK organisieren und halten" msgstr "Menschen, die den AK organisieren und halten"
#: models.py:165 #: AKModel/models.py:355
msgid "Link to wiki page" msgid "Link to wiki page"
msgstr "Link zur Wiki Seite" msgstr "Link zur Wiki Seite"
#: models.py:167 #: AKModel/models.py:356
msgid "Protocol Link"
msgstr "Protokolllink"
#: AKModel/models.py:356
msgid "Link to protocol"
msgstr "Link zum Protokoll"
#: AKModel/models.py:358
msgid "Category" msgid "Category"
msgstr "Kategorie" msgstr "Kategorie"
#: models.py:168 #: AKModel/models.py:359
msgid "Category of the AK" msgid "Category of the AK"
msgstr "Kategorie des AKs" msgstr "Kategorie des AKs"
#: models.py:169 #: AKModel/models.py:360
msgid "Tags" msgid "Types"
msgstr "Tags" msgstr "Typen"
#: models.py:169 #: AKModel/models.py:361
msgid "Tags provided by owners" msgid "This AK is"
msgstr "Tags, die durch die AK Leitung vergeben wurden" msgstr "Dieser AK ist"
#: models.py:170 #: AKModel/models.py:362
msgid "Track" msgid "Track"
msgstr "Track" msgstr "Track"
#: models.py:171 #: AKModel/models.py:363
msgid "Track the AK belongs to" msgid "Track the AK belongs to"
msgstr "Track zu dem der AK gehört" msgstr "Track zu dem der AK gehört"
#: models.py:173 #: AKModel/models.py:365
msgid "Resolution Intention" msgid "Resolution Intention"
msgstr "Resolutionsabsicht" msgstr "Resolutionsabsicht"
#: models.py:174 #: AKModel/models.py:366
msgid "Intends to submit a resolution" msgid "Intends to submit a resolution"
msgstr "Beabsichtigt eine Resolution einzureichen" msgstr "Beabsichtigt eine Resolution einzureichen"
#: models.py:175 #: AKModel/models.py:367
msgid "Present this AK" msgid "Present this AK"
msgstr "AK Präsentieren" msgstr "AK präsentieren"
#: models.py:176 #: AKModel/models.py:368
msgid "Present results of this AK" msgid "Present results of this AK"
msgstr "Die Ergebnisse dieses AKs vorstellen" msgstr "Die Ergebnisse dieses AKs vorstellen"
#: models.py:178 #: AKModel/models.py:370 AKModel/views/status.py:167
msgid "Requirements" msgid "Requirements"
msgstr "Anforderungen" msgstr "Anforderungen"
#: models.py:179 #: AKModel/models.py:371
msgid "AK's Requirements" msgid "AK's Requirements"
msgstr "Anforderungen des AKs" msgstr "Anforderungen des AKs"
#: models.py:181 #: AKModel/models.py:373
msgid "Conflicting AKs" msgid "Conflicting AKs"
msgstr "AK Konflikte" msgstr "AK-Konflikte"
#: models.py:182 #: AKModel/models.py:374
msgid "AKs that conflict and thus must not take place at the same time" msgid "AKs that conflict and thus must not take place at the same time"
msgstr "" msgstr ""
"AKs, die Konflikte haben und deshalb nicht gleichzeitig stattfinden dürfen" "AKs, die Konflikte haben und deshalb nicht gleichzeitig stattfinden dürfen"
#: models.py:183 #: AKModel/models.py:375
msgid "Prerequisite AKs" msgid "Prerequisite AKs"
msgstr "Vorausgesetzte AKs" msgstr "Vorausgesetzte AKs"
#: models.py:184 #: AKModel/models.py:376
msgid "AKs that should precede this AK in the schedule" msgid "AKs that should precede this AK in the schedule"
msgstr "AKS die im AK Plan vor diesem AK stattfinden müssen" msgstr "AKs die im AK-Plan vor diesem AK stattfinden müssen"
#: models.py:186 #: AKModel/models.py:378
msgid "Internal Notes" msgid "Organizational Notes"
msgstr "Interne Notizen" msgstr "Notizen zur Organisation"
#: models.py:186 #: AKModel/models.py:379
msgid "Notes to organizers" msgid ""
msgstr "Notizen an die Organisator*innen" "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)."
msgstr ""
"Notizen an die Organisator*innen. Diese sind öffentlich, für private "
"Anmerkungen bitte den Button für Direktnachrichten verwenden (nach dem "
"Anlegen/Bearbeiten)."
#: models.py:188 #: AKModel/models.py:382
msgid "Interest" msgid "Interest"
msgstr "Interesse" msgstr "Interesse"
#: models.py:188 #: AKModel/models.py:382
msgid "Expected number of people" msgid "Expected number of people"
msgstr "Erwartete Personenzahl" msgstr "Erwartete Personenzahl"
#: models.py:195 #: AKModel/models.py:383
msgid "AKs" msgid "Interest Counter"
msgstr "AKs" msgstr "Interessenszähler"
#: models.py:215 #: AKModel/models.py:384
msgid "People who have indicated interest online"
msgstr "Anzahl Personen, die online Interesse bekundet haben"
#: AKModel/models.py:389
msgid "Export?"
msgstr "Export?"
#: AKModel/models.py:390
msgid "Include AK in wiki export?"
msgstr "AK bei Wiki-Export berücksichtigen?"
#: AKModel/models.py:536
msgid "Name or number of the room" msgid "Name or number of the room"
msgstr "Name oder Nummer des Raums" msgstr "Name oder Nummer des Raums"
#: models.py:216 #: AKModel/models.py:537
msgid "Building" msgid "Location"
msgstr "Gebäude" msgstr "Ort"
#: models.py:217 #: AKModel/models.py:538
msgid "Name or number of the building" msgid "Name or number of the location"
msgstr "Name oder Nummer des Gebäudes" msgstr "Name oder Nummer des Ortes"
#: models.py:218 #: AKModel/models.py:539
msgid "Capacity" msgid "Capacity"
msgstr "Kapazität" msgstr "Kapazität"
#: models.py:218 #: AKModel/models.py:540
msgid "Maximum number of people" msgid "Maximum number of people (-1 for unlimited)."
msgstr "Maximale Personenzahl" msgstr "Maximale Personenzahl (-1 wenn unbeschränkt)."
#: models.py:219 #: AKModel/models.py:541
msgid "Properties" msgid "Properties"
msgstr "Eigenschaften" msgstr "Eigenschaften"
#: models.py:220 #: AKModel/models.py:542
msgid "AK requirements fulfilled by the room" msgid "AK requirements fulfilled by the room"
msgstr "AK Anforderungen, die dieser Raum erfüllt" msgstr "AK-Anforderungen, die dieser Raum erfüllt"
#: models.py:227 #: AKModel/models.py:551 AKModel/views/status.py:59
msgid "Rooms" msgid "Rooms"
msgstr "Räume" msgstr "Räume"
#: models.py:240 #: AKModel/models.py:574
msgid "AK being mapped" msgid "AK being mapped"
msgstr "AK, der zugeordnet wird" msgstr "AK, der zugeordnet wird"
#: models.py:242 #: AKModel/models.py:576
msgid "Room the AK will take place in" msgid "Room the AK will take place in"
msgstr "Raum in dem der AK stattfindet" msgstr "Raum in dem der AK stattfindet"
#: models.py:243 #: AKModel/models.py:577 AKModel/models.py:920
msgid "Slot Begin" msgid "Slot Begin"
msgstr "Beginn des Slots" msgstr "Beginn des Slots"
#: models.py:243 #: AKModel/models.py:577 AKModel/models.py:920
msgid "Time and date the slot begins" msgid "Time and date the slot begins"
msgstr "Zeit und Datum zu der der AK beginnt" msgstr "Zeit und Datum zu der der AK beginnt"
#: models.py:245 #: AKModel/models.py:579
msgid "Duration" msgid "Duration"
msgstr "Dauer" msgstr "Dauer"
#: models.py:246 #: AKModel/models.py:580
msgid "Length in hours" msgid "Length in hours"
msgstr "Länge in Stunden" msgstr "Länge in Stunden"
#: models.py:252 #: AKModel/models.py:582
msgid "Scheduling fixed"
msgstr "Planung fix"
#: AKModel/models.py:583
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:588
msgid "Last update"
msgstr "Letzte Aktualisierung"
#: AKModel/models.py:591
msgid "AK Slot" msgid "AK Slot"
msgstr "AK Slot" msgstr "AK-Slot"
#: models.py:253 #: AKModel/models.py:592 AKModel/models.py:738
msgid "AK Slots" msgid "AK Slots"
msgstr "AK Slot" msgstr "AK-Slot"
#: models.py:267 #: AKModel/models.py:614 AKModel/models.py:623
msgid "Not scheduled yet" msgid "Not scheduled yet"
msgstr "Noch nicht geplant" msgstr "Noch nicht geplant"
#: AKModel/models.py:671
msgid "AK this message belongs to"
msgstr "AK zu dem die Nachricht gehört"
#: AKModel/models.py:672
msgid "Message text"
msgstr "Nachrichtentext"
#: AKModel/models.py:673
msgid "Message to the organizers. This is not publicly visible."
msgstr ""
"Nachricht an die Organisator*innen. Diese ist nicht öffentlich sichtbar."
#: AKModel/models.py:677
msgid "Resolved"
msgstr "Erledigt"
#: AKModel/models.py:678
msgid "This message has been resolved (no further action needed)"
msgstr ""
"Diese Nachricht wurde vollständig bearbeitet (keine weiteren Aktionen "
"notwendig)"
#: AKModel/models.py:681
msgid "AK Orga Message"
msgstr "AK-Organachricht"
#: AKModel/models.py:682
msgid "AK Orga Messages"
msgstr "AK-Organachrichten"
#: AKModel/models.py:699
msgid "Constraint Violation"
msgstr "Constraintverletzung"
#: AKModel/models.py:700
msgid "Constraint Violations"
msgstr "Constraintverletzungen"
#: AKModel/models.py:707
msgid "Owner has two parallel slots"
msgstr "Leitung hat zwei Slots parallel"
#: AKModel/models.py:708
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:709
msgid "Room has two AK slots scheduled at the same time"
msgstr "Raum hat zwei AK Slots gleichzeitig"
#: AKModel/models.py:710
msgid "Room does not satisfy the requirement of the scheduled AK"
msgstr "Room erfüllt die Anforderungen des platzierten AKs nicht"
#: AKModel/models.py:711
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:712
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:714
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:715
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:716
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:717
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:718
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:724
msgid "Warning"
msgstr "Warnung"
#: AKModel/models.py:725
msgid "Violation"
msgstr "Verletzung"
#: AKModel/models.py:727
msgid "Type"
msgstr "Art"
#: AKModel/models.py:728
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:729
msgid "Level"
msgstr "Level"
#: AKModel/models.py:730
msgid "Severity level of the violation"
msgstr "Schweregrad der Verletzung"
#: AKModel/models.py:737
msgid "AK(s) belonging to this constraint"
msgstr "AK(s), die zu diesem Constraint gehören"
#: AKModel/models.py:739
msgid "AK Slot(s) belonging to this constraint"
msgstr "AK Slot(s), die zu diesem Constraint gehören"
#: AKModel/models.py:741
msgid "AK Owner belonging to this constraint"
msgstr "AK Leitung(en), die zu diesem Constraint gehören"
#: AKModel/models.py:743
msgid "Room belonging to this constraint"
msgstr "Raum, der zu diesem Constraint gehört"
#: AKModel/models.py:746
msgid "AK Requirement belonging to this constraint"
msgstr "AK Anforderung, die zu diesem Constraint gehört"
#: AKModel/models.py:748
msgid "AK Category belonging to this constraint"
msgstr "AK Kategorie, di zu diesem Constraint gehört"
#: AKModel/models.py:750
msgid "Comment"
msgstr "Kommentar"
#: AKModel/models.py:750
msgid "Comment or further details for this violation"
msgstr "Kommentar oder weitere Details zu dieser Vereletzung"
#: AKModel/models.py:753
msgid "Timestamp"
msgstr "Timestamp"
#: AKModel/models.py:753
msgid "Time of creation"
msgstr "Zeitpunkt der ERstellung"
#: AKModel/models.py:754
msgid "Manually Resolved"
msgstr "Manuell behoben"
#: AKModel/models.py:755
msgid "Mark this violation manually as resolved"
msgstr "Markiere diese Verletzung manuell als behoben"
#: AKModel/models.py:782 AKModel/templates/admin/AKModel/aks_by_user.html:22
#: AKModel/templates/admin/AKModel/requirements_overview.html:27
msgid "Details"
msgstr "Details"
#: AKModel/models.py:916
msgid "Default Slot"
msgstr "Standardslot"
#: AKModel/models.py:921
msgid "Slot End"
msgstr "Ende des Slots"
#: AKModel/models.py:921
msgid "Time and date the slot ends"
msgstr "Zeit und Datum zu der der Slot endet"
#: AKModel/models.py:926
msgid "Primary categories"
msgstr "Primäre Kategorien"
#: AKModel/models.py:927
msgid "Categories that should be assigned to this slot primarily"
msgstr "Kategorieren, die diesem Slot primär zugewiesen werden sollen"
#: AKModel/site.py:14
msgid "Administration"
msgstr "Verwaltung"
#: AKModel/templates/AKModel/user.html:23
msgid "Hello"
msgstr "Hallo"
#: AKModel/templates/AKModel/user.html:26
msgid "Go to backend"
msgstr "Zum Backend"
#: AKModel/templates/AKModel/user.html:29
msgid "Please wait for an administrator to confirm your account"
msgstr ""
"Bitte warte darauf, dass ein*e Administrator*in deinen Account bestätigt"
#: AKModel/templates/AKModel/user.html:32
msgid "Logout"
msgstr "Ausloggen"
#: AKModel/templates/admin/AKModel/action_intermediate.html:23
msgid "Confirm"
msgstr "Bestätigen"
#: AKModel/templates/admin/AKModel/action_intermediate.html:27
#: 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
#: AKModel/templates/admin/AKModel/event_wizard/import.html:9
#: AKModel/templates/admin/AKModel/event_wizard/settings.html:9
#: AKModel/templates/admin/AKModel/event_wizard/start.html:8
#: AKModel/templates/admin/AKModel/event_wizard/wizard_steps.html:3
msgid "New event wizard"
msgstr "Assistent zum Anlegen eines neuen Events"
#: 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:21
msgid "New event:"
msgstr "Neues Event:"
#: 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:42
msgid "Skip Import"
msgstr "Import überspringen"
#: 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"
#: AKModel/templates/admin/AKModel/event_wizard/finish.html:18
msgid "Congratulations. Everything is set up!"
msgstr "Herzlichen Glückwunsch. Alles ist eingerichtet!"
#: AKModel/templates/admin/AKModel/event_wizard/settings.html:29
msgid "Back"
msgstr "Zurück"
#: 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."
msgstr ""
"Neues Event anlegen. Bitte zunächst diese Grundeinstellungen ausfüllen, "
"weitere Einstellungen können später gesetzt werden."
#: AKModel/templates/admin/AKModel/event_wizard/wizard_steps.html:15
msgid "Step"
msgstr "Schritt"
#: AKModel/templates/admin/AKModel/message_delete.html:8
#, python-format
msgid ""
"Are you sure you want to delete all orga messages for %(event)s? This will "
"permanently delete %(message_count)s message(s):"
msgstr ""
"Sollen wirklich alle Organachrichten für %(event)s gelöscht werden? Dadurch "
"werden %(message_count)s Nachricht(en) dauerhaft gelöscht:"
#: AKModel/templates/admin/AKModel/requirements_overview.html:12
msgid "Requirements Overview"
msgstr "Übersicht Anforderungen"
#: 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:183
msgid "Add Requirement"
msgstr "Anforderung hinzufügen"
#: AKModel/templates/admin/AKModel/room_create.html:9
#: AKModel/templates/admin/AKModel/room_create.html:12
msgid "Create room"
msgstr "Raum anlegen"
#: AKModel/templates/admin/AKModel/room_create.html:20
msgid "Save and add another"
msgstr "Sichern und neu hinzufügen"
#: AKModel/templates/admin/AKModel/room_create.html:23
msgid "Save and continue editing"
msgstr "Sichern und weiter bearbeiten"
#: AKModel/templates/admin/AKModel/room_create.html:26
msgid "Save"
msgstr "Sichern"
#: AKModel/templates/admin/AKModel/status/event_aks.html:5
msgid "No AKs yet"
msgstr "Bisher keine AKs"
#: AKModel/templates/admin/AKModel/status/event_aks.html:13
msgid "Slots"
msgstr "Slots"
#: AKModel/templates/admin/AKModel/status/event_aks.html:16
msgid "Unscheduled Slots"
msgstr "Ungeplante Slots"
#: AKModel/templates/admin/AKModel/status/event_categories.html:4
msgid "No categories yet"
msgstr "Bisher keine Kategorien"
#: AKModel/templates/admin/AKModel/status/event_overview.html:12
msgid "Plan published?"
msgstr "Plan veröffentlicht?"
#: AKModel/templates/admin/AKModel/status/event_requirements.html:4
msgid "No requirements yet"
msgstr "Bisher keine Anforderungen"
#: AKModel/templates/admin/AKModel/status/event_rooms.html:4
msgid "No rooms yet"
msgstr "Bisher keine Räume"
#: AKModel/templates/admin/ak_index.html:7
msgid "Active Events"
msgstr "Aktive Events"
#: AKModel/templates/admin/ak_index.html:16 AKModel/views/status.py:113
msgid "Scheduling"
msgstr "Scheduling"
#: AKModel/templates/admin/login.html:8
msgid "Please correct the error below."
msgstr "Bitte den untenstehenden Fehler korrigieren."
#: AKModel/templates/admin/login.html:8
msgid "Please correct the errors below."
msgstr "Bitte die unten stehenden Fehler korrigieren."
#: AKModel/templates/admin/login.html:24
#, python-format
msgid ""
"You are authenticated as %(username)s, but are not authorized to access this "
"page. Would you like to login to a different account?"
msgstr ""
"Du bist als %(username)s eingeloggt, aber bist nicht authorisiert, auf diese "
"Seite zuzugreifen. Möchtest du dich mit einem anderem Account einloggen?"
#: AKModel/templates/admin/login.html:44
msgid "Forgotten your password or username?"
msgstr "Passwort oder Username vergessen"
#: AKModel/templates/admin/login.html:48
msgid "Log in"
msgstr "Login"
#: AKModel/templates/admin/login.html:51
msgid "Register"
msgstr "Registrieren"
#: AKModel/views/ak.py:17
msgid "Requirements for Event"
msgstr "Anforderungen für das Event"
#: AKModel/views/ak.py:34
msgid "AK CSV Export"
msgstr "AK-CSV-Export"
#: AKModel/views/ak.py:48
msgid "AK Wiki Export"
msgstr "AK-Wiki-Export"
#: AKModel/views/ak.py:59 AKModel/views/manage.py:53
msgid "Wishes"
msgstr "Wünsche"
#: AKModel/views/ak.py:71
msgid "Delete AK Orga Messages"
msgstr "AK-Organachrichten löschen"
#: AKModel/views/ak.py:89
msgid "AK Orga Messages successfully deleted"
msgstr "AK-Organachrichten erfolgreich gelöscht"
#: 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:102
msgid "Reset of interest in AKs successful."
msgstr "Interesse an AKs erfolgreich zurückgesetzt."
#: 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:117
msgid "AKs' interest counters set back to 0."
msgstr "Interessenszähler der AKs zurückgesetzt"
#: AKModel/views/event_wizard.py:104
#, python-format
msgid "Copied '%(obj)s'"
msgstr "'%(obj)s' kopiert"
#: 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:35 AKModel/views/status.py:150
msgid "Export AK Slides"
msgstr "AK-Folien exportieren"
#: AKModel/views/manage.py:48
msgid "Symbols"
msgstr "Symbole"
#: AKModel/views/manage.py:49
msgid "Who?"
msgstr "Wer?"
#: AKModel/views/manage.py:50
msgid "Duration(s)"
msgstr "Dauer(n)"
#: AKModel/views/manage.py:51
msgid "Reso intention?"
msgstr "Resolutionsabsicht?"
#: AKModel/views/manage.py:52
msgid "Category (for Wishes)"
msgstr "Kategorie (für Wünsche)"
#: AKModel/views/manage.py:101
msgid "The following Constraint Violations will be marked as manually resolved"
msgstr ""
"Die folgenden Constraintverletzungen werden als manuell behoben markiert."
#: AKModel/views/manage.py:102
msgid "Constraint Violations marked as resolved"
msgstr "Constraintverletzungen als manuell behoben markiert"
#: AKModel/views/manage.py:114
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:115
msgid "Constraint Violations set to level 'violation'"
msgstr "Constraintverletzungen auf Level \"Violation\" gesetzt"
#: AKModel/views/manage.py:127
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:128
msgid "Constraint Violations set to level 'warning'"
msgstr "Constraintverletzungen auf Level \"Warning\" gesetzt"
#: AKModel/views/manage.py:140
msgid "Publish the plan(s) of:"
msgstr "Den Plan/die Pläne veröffentlichen von:"
#: AKModel/views/manage.py:141
msgid "Plan published"
msgstr "Plan veröffentlicht"
#: AKModel/views/manage.py:153
msgid "Unpublish the plan(s) of:"
msgstr "Den Plan/die Pläne verbergen von:"
#: AKModel/views/manage.py:154
msgid "Plan unpublished"
msgstr "Plan verborgen"
#: AKModel/views/manage.py:166 AKModel/views/status.py:134
msgid "Edit Default Slots"
msgstr "Standardslots bearbeiten"
#: AKModel/views/manage.py:204
#, 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:235
#, 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:37
#, python-format
msgid "Created Room '%(room)s'"
msgstr "Raum '%(room)s' angelegt"
#: 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:96
#, python-brace-format
msgid "Could not import room {name}: {e}"
msgstr "Konnte Raum {name} nicht importieren: {e}"
#: AKModel/views/room.py:101
#, python-brace-format
msgid "Imported {count} room(s)"
msgstr "{count} Raum/Räume importiert"
#: AKModel/views/room.py:103
msgid "No rooms imported"
msgstr "Keine Räume importiert"
#: AKModel/views/status.py:16
msgid "Overview"
msgstr "Überblick"
#: AKModel/views/status.py:32
msgid "Categories"
msgstr "Kategorien"
#: AKModel/views/status.py:36
msgid "Add category"
msgstr "Kategorie hinzufügen"
#: AKModel/views/status.py:63
msgid "Add Room"
msgstr "Raum hinzufügen"
#: AKModel/views/status.py:120
msgid "AKs requiring special attention"
msgstr "AKs, die besondere Aufmerksamkeit benötigen"
#: AKModel/views/status.py:126
msgid "Enter Interest"
msgstr "Interesse erfassen"
#: AKModel/views/status.py:138
msgid "Manage ak tracks"
msgstr "AK-Tracks verwalten"
#: AKModel/views/status.py:142
msgid "Export AKs as CSV"
msgstr "AKs als CSV exportieren"
#: AKModel/views/status.py:146
msgid "Export AKs for Wiki"
msgstr "AKs im Wiki-Format exportieren"
#: AKModel/views/status.py:179
msgid "Show AKs for requirements"
msgstr "Zu Anforderungen gehörige AKs anzeigen"
#: AKModel/views/status.py:193
msgid "Event Status"
msgstr "Eventstatus"
#~ msgid "Opening time for expression of interest."
#~ msgstr "Öffnungszeitpunkt für die Angabe von Interesse an AKs."
#~ msgid "Messages"
#~ msgstr "Nachrichten"
#~ msgid "Delete all messages"
#~ msgstr "Alle Nachrichten löschen"
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
for file_entry in all_files:
if file_entry.dirpath == ".":
file_entry.dirpath = ""
elif file_entry.dirpath.startswith(".\\"):
file_entry.dirpath = file_entry.dirpath[2:].replace("\\", "/")
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:
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)
return pot_files
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()
from abc import ABC, abstractmethod
from django.contrib import admin, messages
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from django.views.generic import FormView
from AKModel.forms import AdminIntermediateForm, AdminIntermediateActionForm
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
return context
class FilterByEventSlugMixin(EventSlugMixin):
"""
Mixin to filter different querysets based on a event slug from the request url
"""
def get_queryset(self):
"""
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))
if self.site_url != '':
extra["site_url"] = self.site_url
if self.title != '':
extra["title"] = self.title
return extra
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):
context = super().get_context_data(**kwargs)
context["title"] = self.title
context["preview"] = self.get_preview()
return context
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"] = [
_("Start"),
_("Settings"),
_("Event created, Prepare Import"),
_("Import categories & requirements"),
_("Activate?"),
_("Finish")
]
context["wizard_step_text"] = context["wizard_steps"][self.wizard_step - 1]
context["wizard_steps_total"] = len(context["wizard_steps"])
return context
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(","))
def get_initial(self):
initial = super().get_initial()
initial['pks'] = self.request.GET['pks']
return initial
def get_preview(self):
self.entities = self.get_queryset()
joined_entities = '\n'.join(str(e) for e in self.entities)
return f"{self.confirmation_message}:\n\n {joined_entities}"
def get_success_url(self):
return reverse(f"admin:{self.model._meta.app_label}_{self.model._meta.model_name}_changelist")
@abstractmethod
def action(self, form):
"""
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'])
self.action(form)
messages.add_message(self.request, messages.SUCCESS, self.success_message)
return super().form_valid(form)
class LoopActionMixin(ABC):
"""
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)
entity.save()
self.post_action()
@abstractmethod
def perform_action(self, entity):
"""
Action to perform on each entity
:param entity: entity to perform the action on
"""
def pre_action(self):
"""
Callback for custom action before loop starts
"""
def post_action(self):
"""
Callback for custom action after loop finished
"""
from abc import ABC, abstractmethod
from collections import defaultdict
from django.template import loader
from django.views.generic import TemplateView
from AKModel.metaviews.admin import AdminViewMixin
class StatusWidget(ABC):
"""
Abstract parent for status page widgets
"""
title = "Status Widget"
actions = []
status = "primary"
@property
@abstractmethod
def required_context_type(self) -> str:
"""
Which model/context is needed to render this widget?
"""
def get_context_data(self, context) -> dict:
"""
Allow to manipulate the context
:return: context (with or without changes)
"""
return context
def render(self, context: {}, request) -> dict:
"""
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)
return {
"body": self.render_body(context, request),
"title": self.render_title(context),
"actions": self.render_actions(context),
"status": self.render_status(context),
}
def render_title(self, context: {}) -> str: # pylint: disable=unused-argument
"""
Render title for widget based on context
By default, the title attribute is used without modification
:param context: Context for rendering
:return: Rendered title
"""
return self.title
def render_status(self, context: {}) -> str: # pylint: disable=unused-argument
"""
Render status for widget based on context
By default, the status attribute is used without modification
:param context: Context for rendering
:return: Rendered title
"""
return self.status
@abstractmethod
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)
"""
def render_actions(self, context: {}) -> list[dict]: # pylint: disable=unused-argument
"""
Render actions for widget based on context
By default, all actions specified for this widget are returned without modification
:param context: Context for rendering
:return: List of 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:
"""
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)
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)
def register(self, name: str):
"""
Call this as
@status_manager.register(name="xyz")
to register a status widget
:param name: name of this widget (only used internally). Has to be unique.
"""
def _register(widget_class):
w = widget_class()
self.widgets[name] = w
self.widgets_by_context_type[w.required_context_type].append(w)
return widget_class
return _register
def get_by_context_type(self, context_type: str):
"""
Filter widgets for ones suitable for provided context
:param context_type: name of the model provided as context
:return: a list of all matching widgets
"""
if context_type in self.widgets_by_context_type.keys():
return self.widgets_by_context_type[context_type]
return []
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
@abstractmethod
def provided_context_type(self) -> str:
"""
Which model/context is provided by this status view?
"""
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
# 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)
...@@ -33,9 +33,8 @@ class Migration(migrations.Migration): ...@@ -33,9 +33,8 @@ class Migration(migrations.Migration):
migrate_data_forward, migrate_data_forward,
migrations.RunPython.noop, migrations.RunPython.noop,
), ),
migrations.AlterField( migrations.AlterUniqueTogether(
model_name='akowner', name='akowner',
name='slug', unique_together={('event', 'name', 'institution'), ('event', 'slug')},
field=models.SlugField(blank=True, help_text='Slug for URL generation', unique=True, max_length=64, verbose_name='Slug')
) )
] ]
# Generated by Django 2.2.6 on 2019-10-25 12:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0021_base_url'),
]
operations = [
migrations.RemoveField(
model_name='akowner',
name='email',
),
]
# Generated by Django 2.2.6 on 2019-10-25 13:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0022_remove_akowner_email'),
]
operations = [
migrations.AddField(
model_name='event',
name='default_slot',
field=models.DecimalField(decimal_places=2, default=2,
help_text='Default length in hours that is assumed for AKs in this event.',
max_digits=4, verbose_name='Default Slot Length'),
),
]