Skip to content
Snippets Groups Projects

Compare revisions

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

Source

Select target project
No results found

Target

Select target project
  • konstantin/akplanning
  • matedealer/akplanning
  • kif/akplanning
  • mirco/akplanning
  • lordofthevoid/akplanning
  • voidptr/akplanning
  • xayomer/akplanning-fork
  • mollux/akplanning
  • neumantm/akplanning
  • mmarx/akplanning
  • nerf/akplanning
  • felix_bonn/akplanning
  • sebastian.uschmann/akplanning
13 results
Show changes
Commits on Source (59)
Showing
with 717 additions and 302 deletions
uwsgi==2.0.23 uwsgi==2.0.28
image: python:3.9 image: python:3.11
services: services:
- mysql - mysql
...@@ -26,10 +26,9 @@ cache: ...@@ -26,10 +26,9 @@ cache:
- pip install pylint-gitlab pylint-django - pip install pylint-gitlab pylint-django
- mysql --version - mysql --version
check: migrations:
extends: .before_script_template extends: .before_script_template
script: script:
- ./Utils/check.sh --all
- source venv/bin/activate - source venv/bin/activate
- ./manage.py makemigrations --dry-run --check - ./manage.py makemigrations --dry-run --check
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-16 16:30+0200\n" "POT-Creation-Date: 2025-01-01 17:28+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"
...@@ -61,17 +61,22 @@ msgstr "Veranstaltung" ...@@ -61,17 +61,22 @@ msgstr "Veranstaltung"
msgid "Event this button belongs to" msgid "Event this button belongs to"
msgstr "Veranstaltung, zu der dieser Button gehört" msgstr "Veranstaltung, zu der dieser Button gehört"
#: AKDashboard/templates/AKDashboard/dashboard.html:17 #: AKDashboard/templates/AKDashboard/dashboard.html:18
#: AKDashboard/templates/AKDashboard/dashboard_event.html:29 #: AKDashboard/templates/AKDashboard/dashboard_event.html:29
#: AKDashboard/templates/AKDashboard/dashboard_row_old_event.html:53
msgid "Write to organizers of this event for questions and comments" msgid "Write to organizers of this event for questions and comments"
msgstr "" msgstr ""
"Kontaktiere die Organisator*innen des Events bei Fragen oder Kommentaren" "Kontaktiere die Organisator*innen des Events bei Fragen oder Kommentaren"
#: AKDashboard/templates/AKDashboard/dashboard.html:24 #: AKDashboard/templates/AKDashboard/dashboard.html:24
msgid "Old events"
msgstr "Frühere Veranstaltungen"
#: AKDashboard/templates/AKDashboard/dashboard.html:34
msgid "Currently, there are no Events!" msgid "Currently, there are no Events!"
msgstr "Aktuell gibt es keine Events!" msgstr "Aktuell gibt es keine Events!"
#: AKDashboard/templates/AKDashboard/dashboard.html:27 #: AKDashboard/templates/AKDashboard/dashboard.html:37
msgid "Please contact an administrator if you want to use AKPlanning." msgid "Please contact an administrator if you want to use AKPlanning."
msgstr "" msgstr ""
"Bitte kontaktiere eine*n Administrator*in, falls du AKPlanning verwenden " "Bitte kontaktiere eine*n Administrator*in, falls du AKPlanning verwenden "
...@@ -81,46 +86,49 @@ msgstr "" ...@@ -81,46 +86,49 @@ msgstr ""
msgid "Recent" msgid "Recent"
msgstr "Kürzlich" msgstr "Kürzlich"
#: AKDashboard/templates/AKDashboard/dashboard_row.html:12 #: AKDashboard/templates/AKDashboard/dashboard_row.html:18
#: AKDashboard/templates/AKDashboard/dashboard_row_old_event.html:20
msgid "AK List" msgid "AK List"
msgstr "AK-Liste" msgstr "AK-Liste"
#: AKDashboard/templates/AKDashboard/dashboard_row.html:23 #: AKDashboard/templates/AKDashboard/dashboard_row.html:29
msgid "Current AKs" msgid "Current AKs"
msgstr "Aktuelle AKs" msgstr "Aktuelle AKs"
#: AKDashboard/templates/AKDashboard/dashboard_row.html:30 #: AKDashboard/templates/AKDashboard/dashboard_row.html:36
msgid "AK Wall" msgid "AK Wall"
msgstr "AK-Wall" msgstr "AK-Wall"
#: AKDashboard/templates/AKDashboard/dashboard_row.html:38 #: AKDashboard/templates/AKDashboard/dashboard_row.html:44
#: AKDashboard/templates/AKDashboard/dashboard_row_old_event.html:30
msgid "Schedule" msgid "Schedule"
msgstr "AK-Plan" msgstr "AK-Plan"
#: AKDashboard/templates/AKDashboard/dashboard_row.html:49 #: AKDashboard/templates/AKDashboard/dashboard_row.html:55
msgid "AK Submission" msgid "AK Submission"
msgstr "AK-Einreichung" msgstr "AK-Einreichung"
#: AKDashboard/templates/AKDashboard/dashboard_row.html:57 #: AKDashboard/templates/AKDashboard/dashboard_row.html:63
#: AKDashboard/templates/AKDashboard/dashboard_row_old_event.html:39
msgid "AK History" msgid "AK History"
msgstr "AK-Verlauf" msgstr "AK-Verlauf"
#: AKDashboard/views.py:59 #: AKDashboard/views.py:69
#, python-format #, python-format
msgid "New AK: %(ak)s." msgid "New AK: %(ak)s."
msgstr "Neuer AK: %(ak)s." msgstr "Neuer AK: %(ak)s."
#: AKDashboard/views.py:62 #: AKDashboard/views.py:72
#, python-format #, python-format
msgid "AK \"%(ak)s\" edited." msgid "AK \"%(ak)s\" edited."
msgstr "AK \"%(ak)s\" bearbeitet." msgstr "AK \"%(ak)s\" bearbeitet."
#: AKDashboard/views.py:65 #: AKDashboard/views.py:75
#, python-format #, python-format
msgid "AK \"%(ak)s\" deleted." msgid "AK \"%(ak)s\" deleted."
msgstr "AK \"%(ak)s\" gelöscht." msgstr "AK \"%(ak)s\" gelöscht."
#: AKDashboard/views.py:80 #: AKDashboard/views.py:90
#, python-format #, python-format
msgid "AK \"%(ak)s\" (re-)scheduled." msgid "AK \"%(ak)s\" (re-)scheduled."
msgstr "AK \"%(ak)s\" (um-)geplant." msgstr "AK \"%(ak)s\" (um-)geplant."
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
margin-bottom: 5em; margin-bottom: 5em;
} }
.dashboard-row-small {
margin-bottom: 3em;
}
.dashboard-row > .row { .dashboard-row > .row {
margin-left: 0; margin-left: 0;
padding-bottom: 1em; padding-bottom: 1em;
......
...@@ -9,16 +9,26 @@ ...@@ -9,16 +9,26 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% for event in events %} {% if total_event_count > 0 %}
<div class="dashboard-row"> {% for event in active_and_current_events %}
{% include "AKDashboard/dashboard_row.html" %} <div class="dashboard-row">
{% if event.contact_email %} {% include "AKDashboard/dashboard_row.html" %}
<p> {% if event.contact_email %}
<a href="mailto:{{ event.contact_email }}">{% fa6_icon "envelope" "fas" %} {% trans "Write to organizers of this event for questions and comments" %}</a> <p>
</p> <a href="mailto:{{ event.contact_email }}">{% fa6_icon "envelope" "fas" %} {% trans "Write to organizers of this event for questions and comments" %}</a>
{% endif %} </p>
</div> {% endif %}
{% empty %} </div>
{% endfor %}
{% if old_event_count > 0 %}
<h2 class="mb-3">{% trans "Old events" %}</h2>
{% for event in old_events %}
<div class="dashboard-row-small">
{% include "AKDashboard/dashboard_row_old_event.html" %}
</div>
{% endfor %}
{% endif %}
{% else %}
<div class="jumbotron"> <div class="jumbotron">
<h2 class="display-4"> <h2 class="display-4">
{% trans 'Currently, there are no Events!' %} {% trans 'Currently, there are no Events!' %}
...@@ -27,5 +37,5 @@ ...@@ -27,5 +37,5 @@
{% trans 'Please contact an administrator if you want to use AKPlanning.' %} {% trans 'Please contact an administrator if you want to use AKPlanning.' %}
</p> </p>
</div> </div>
{% endfor %} {% endif %}
{% endblock %} {% endblock %}
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
{% load fontawesome_6 %} {% load fontawesome_6 %}
<h2><a href="{% url 'dashboard:dashboard_event' slug=event.slug %}">{{ event.name }}</a></h2> <h2><a href="{% url 'dashboard:dashboard_event' slug=event.slug %}">{{ event.name }}</a></h2>
<h4 class="text-muted">
{% if event.place %}
<b>{{ event.place }} &middot;</b>
{% endif %}
{{ event | event_month_year }}
</h4>
<div class="mt-2"> <div class="mt-2">
{% if 'AKSubmission'|check_app_installed %} {% if 'AKSubmission'|check_app_installed %}
<a class="dashboard-box btn btn-primary" <a class="dashboard-box btn btn-primary"
......
{% load i18n %}
{% load tags_AKModel %}
{% load fontawesome_6 %}
<h3><a href="{% url 'dashboard:dashboard_event' slug=event.slug %}">{{ event.name }}</a>
<span class="text-muted">
&middot;
{% if event.place %}
{{ event.place }} &middot;
{% endif %}
{{ event | event_month_year }}
</span>
</h3>
<div class="mt-2">
{% if 'AKSubmission'|check_app_installed %}
<a class="btn btn-primary"
href="{% url 'submit:ak_list' event_slug=event.slug %}">
<div class="col-sm-12 col-md-3 col-lg-2 dashboard-button">
<span class="fa fa-list-ul"></span>
<span class='text'>{% trans 'AK List' %}</span>
</div>
</a>
{% endif %}
{% if 'AKPlan'|check_app_installed %}
{% if not event.plan_hidden or user.is_staff %}
<a class="btn btn-primary"
href="{% url 'plan:plan_overview' event_slug=event.slug %}">
<div class="col-sm-12 col-md-3 col-lg-2 dashboard-button">
<span class="fa fa-calendar-alt"></span>
<span class='text'>{% trans 'Schedule' %}</span>
</div>
</a>
{% endif %}
{% endif %}
<a class="btn btn-primary"
href="{% url 'dashboard:dashboard_event' slug=event.slug %}#history">
<div class="col-sm-12 col-md-3 col-lg-2 dashboard-button">
<span class="fa fa-history"></span>
<span class='text'>{% trans 'AK History' %}</span>
</div>
</a>
{% for button in event.dashboardbutton_set.all %}
<a class="btn btn-{{ button.get_color_display }}"
href="{{ button.url }}">
<div class="col-sm-12 col-md-3 col-lg-2 dashboard-button">
{% if button.icon %}<span class="fa">{{ button.icon.as_html }}</span>{% endif %}
<span class='text'>{{ button.text }}</span>
</div>
</a>
{% endfor %}
<a class="btn btn-info"
href=mailto:{{ event.contact_email }}"
title="{% trans 'Write to organizers of this event for questions and comments' %}">
{% fa6_icon "envelope" "fas" %}
</a>
</div>
import zoneinfo import zoneinfo
from django.apps import apps from django.apps import apps
from django.test import TestCase, override_settings from django.test import override_settings, TestCase
from django.urls import reverse from django.urls import reverse
from django.utils.timezone import now from django.utils.timezone import now
from AKDashboard.models import DashboardButton from AKDashboard.models import DashboardButton
from AKModel.models import Event, AK, AKCategory from AKModel.models import AK, AKCategory, Event
from AKModel.tests import BasicViewTests from AKModel.tests import BasicViewTests
...@@ -13,6 +14,7 @@ class DashboardTests(TestCase): ...@@ -13,6 +14,7 @@ class DashboardTests(TestCase):
""" """
Specific Dashboard Tests Specific Dashboard Tests
""" """
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):
""" """
...@@ -20,17 +22,17 @@ class DashboardTests(TestCase): ...@@ -20,17 +22,17 @@ class DashboardTests(TestCase):
""" """
super().setUpTestData() super().setUpTestData()
cls.event = Event.objects.create( cls.event = Event.objects.create(
name="Dashboard Test Event", name="Dashboard Test Event",
slug="dashboardtest", slug="dashboardtest",
timezone=zoneinfo.ZoneInfo("Europe/Berlin"), timezone=zoneinfo.ZoneInfo("Europe/Berlin"),
start=now(), start=now(),
end=now(), end=now(),
active=True, active=True,
plan_hidden=False, plan_hidden=False,
) )
cls.default_category = AKCategory.objects.create( cls.default_category = AKCategory.objects.create(
name="Test Category", name="Test Category",
event=cls.event, event=cls.event,
) )
def test_dashboard_view(self): def test_dashboard_view(self):
...@@ -62,12 +64,12 @@ class DashboardTests(TestCase): ...@@ -62,12 +64,12 @@ class DashboardTests(TestCase):
# History should be empty # History should be empty
response = self.client.get(url) response = self.client.get(url)
self.assertQuerysetEqual(response.context["recent_changes"], []) self.assertQuerySetEqual(response.context["recent_changes"], [])
AK.objects.create( AK.objects.create(
name="Test AK", name="Test AK",
category=self.default_category, category=self.default_category,
event=self.event, event=self.event,
) )
# History should now contain one AK (Test AK) # History should now contain one AK (Test AK)
...@@ -90,7 +92,8 @@ class DashboardTests(TestCase): ...@@ -90,7 +92,8 @@ class DashboardTests(TestCase):
self.event.save() self.event.save()
response = self.client.get(url_dashboard_index) response = self.client.get(url_dashboard_index)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertFalse(self.event in response.context["events"]) self.assertFalse(self.event in response.context["active_and_current_events"])
self.assertFalse(self.event in response.context["old_events"])
response = self.client.get(url_event_dashboard) response = self.client.get(url_event_dashboard)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertEqual(response.context["event"], self.event) self.assertEqual(response.context["event"], self.event)
...@@ -100,7 +103,7 @@ class DashboardTests(TestCase): ...@@ -100,7 +103,7 @@ class DashboardTests(TestCase):
self.event.save() self.event.save()
response = self.client.get(url_dashboard_index) response = self.client.get(url_dashboard_index)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertTrue(self.event in response.context["events"]) self.assertTrue(self.event in response.context["active_and_current_events"])
def test_active(self): def test_active(self):
""" """
...@@ -153,8 +156,8 @@ class DashboardTests(TestCase): ...@@ -153,8 +156,8 @@ class DashboardTests(TestCase):
self.assertNotContains(response, "Dashboard Button Test") self.assertNotContains(response, "Dashboard Button Test")
DashboardButton.objects.create( DashboardButton.objects.create(
text="Dashboard Button Test", text="Dashboard Button Test",
event=self.event event=self.event
) )
response = self.client.get(url_event_dashboard) response = self.client.get(url_event_dashboard)
......
...@@ -22,7 +22,18 @@ class DashboardView(TemplateView): ...@@ -22,7 +22,18 @@ class DashboardView(TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context['events'] = Event.objects.filter(public=True).prefetch_related('dashboardbutton_set') # 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 return context
......
...@@ -2,6 +2,8 @@ from django import forms ...@@ -2,6 +2,8 @@ from django import forms
from django.apps import apps from django.apps import apps
from django.contrib import admin, messages from django.contrib import admin, messages
from django.contrib.admin import SimpleListFilter, RelatedFieldListFilter, action, display 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.db.models import Count, F
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
...@@ -15,7 +17,7 @@ from simple_history.admin import SimpleHistoryAdmin ...@@ -15,7 +17,7 @@ from simple_history.admin import SimpleHistoryAdmin
from AKModel.availability.models import Availability from AKModel.availability.models import Availability
from AKModel.forms import RoomFormWithAvailabilities from AKModel.forms import RoomFormWithAvailabilities
from AKModel.models import Event, AKOwner, AKCategory, AKTrack, AKRequirement, AK, AKSlot, Room, AKOrgaMessage, \ from AKModel.models import Event, AKOwner, AKCategory, AKTrack, AKRequirement, AK, AKSlot, Room, AKOrgaMessage, \
ConstraintViolation, DefaultSlot ConstraintViolation, DefaultSlot, AKType
from AKModel.urls import get_admin_urls_event_wizard, get_admin_urls_event from AKModel.urls import get_admin_urls_event_wizard, get_admin_urls_event
from AKModel.views.ak import AKResetInterestView, AKResetInterestCounterView from AKModel.views.ak import AKResetInterestView, AKResetInterestCounterView
from AKModel.views.manage import CVMarkResolvedView, CVSetLevelViolationView, CVSetLevelWarningView from AKModel.views.manage import CVMarkResolvedView, CVSetLevelViolationView, CVSetLevelWarningView
...@@ -215,6 +217,18 @@ class AKRequirementAdmin(PrepopulateWithNextActiveEventMixin, admin.ModelAdmin): ...@@ -215,6 +217,18 @@ class AKRequirementAdmin(PrepopulateWithNextActiveEventMixin, admin.ModelAdmin):
ordering = ['name'] 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): class WishFilter(SimpleListFilter):
""" """
Re-usable filter for wishes Re-usable filter for wishes
...@@ -257,6 +271,7 @@ class AKAdminForm(forms.ModelForm): ...@@ -257,6 +271,7 @@ class AKAdminForm(forms.ModelForm):
self.fields["requirements"].queryset = AKRequirement.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["conflicts"].queryset = AK.objects.filter(event=self.instance.event)
self.fields["prerequisites"].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) @admin.register(AK)
...@@ -555,3 +570,41 @@ class DefaultSlotAdmin(EventTimezoneFormMixin, admin.ModelAdmin): ...@@ -555,3 +570,41 @@ class DefaultSlotAdmin(EventTimezoneFormMixin, admin.ModelAdmin):
list_display = ['start_simplified', 'end_simplified', 'event'] list_display = ['start_simplified', 'end_simplified', 'event']
list_filter = ['event'] list_filter = ['event']
form = DefaultSlotAdminForm 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.action(description=_("Deactivate selected users"))
def deactivate(self, request, queryset):
"""
Bulk deactivate users
: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."))
# Re-register UserAdmin
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
...@@ -193,6 +193,14 @@ ...@@ -193,6 +193,14 @@
"event": 2 "event": 2
} }
}, },
{
"model": "AKModel.aktype",
"pk": 1,
"fields": {
"name": "Input",
"event": 2
}
},
{ {
"model": "AKModel.historicalak", "model": "AKModel.historicalak",
"pk": 1, "pk": 1,
...@@ -206,7 +214,6 @@ ...@@ -206,7 +214,6 @@
"reso": false, "reso": false,
"present": true, "present": true,
"notes": "", "notes": "",
"interest": -1,
"category": 4, "category": 4,
"track": null, "track": null,
"event": 2, "event": 2,
...@@ -229,7 +236,6 @@ ...@@ -229,7 +236,6 @@
"reso": false, "reso": false,
"present": true, "present": true,
"notes": "", "notes": "",
"interest": -1,
"category": 4, "category": 4,
"track": null, "track": null,
"event": 2, "event": 2,
...@@ -252,7 +258,6 @@ ...@@ -252,7 +258,6 @@
"reso": false, "reso": false,
"present": null, "present": null,
"notes": "", "notes": "",
"interest": -1,
"category": 5, "category": 5,
"track": null, "track": null,
"event": 2, "event": 2,
...@@ -275,7 +280,6 @@ ...@@ -275,7 +280,6 @@
"reso": false, "reso": false,
"present": null, "present": null,
"notes": "", "notes": "",
"interest": -1,
"category": 5, "category": 5,
"track": null, "track": null,
"event": 2, "event": 2,
...@@ -298,7 +302,6 @@ ...@@ -298,7 +302,6 @@
"reso": false, "reso": false,
"present": null, "present": null,
"notes": "We need to find a volunteer first...", "notes": "We need to find a volunteer first...",
"interest": -1,
"category": 3, "category": 3,
"track": null, "track": null,
"event": 2, "event": 2,
...@@ -321,7 +324,6 @@ ...@@ -321,7 +324,6 @@
"reso": false, "reso": false,
"present": null, "present": null,
"notes": "We need to find a volunteer first...", "notes": "We need to find a volunteer first...",
"interest": -1,
"category": 3, "category": 3,
"track": null, "track": null,
"event": 2, "event": 2,
...@@ -344,7 +346,6 @@ ...@@ -344,7 +346,6 @@
"reso": false, "reso": false,
"present": null, "present": null,
"notes": "", "notes": "",
"interest": -1,
"category": 5, "category": 5,
"track": 1, "track": 1,
"event": 2, "event": 2,
......
...@@ -10,7 +10,7 @@ from django.forms.utils import ErrorList ...@@ -10,7 +10,7 @@ from django.forms.utils import ErrorList
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from AKModel.availability.forms import AvailabilitiesFormMixin from AKModel.availability.forms import AvailabilitiesFormMixin
from AKModel.models import Event, AKCategory, AKRequirement, Room from AKModel.models import Event, AKCategory, AKRequirement, Room, AKType
class DateTimeInput(forms.DateInput): class DateTimeInput(forms.DateInput):
...@@ -101,6 +101,13 @@ class NewEventWizardImportForm(forms.Form): ...@@ -101,6 +101,13 @@ class NewEventWizardImportForm(forms.Form):
required=False, required=False,
) )
import_types = forms.ModelMultipleChoiceField(
queryset=AKType.objects.all(),
widget=forms.CheckboxSelectMultiple,
label=_("Copy types"),
required=False,
)
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, 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, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None,
...@@ -111,6 +118,8 @@ class NewEventWizardImportForm(forms.Form): ...@@ -111,6 +118,8 @@ class NewEventWizardImportForm(forms.Form):
event=self.initial["import_event"]) event=self.initial["import_event"])
self.fields["import_requirements"].queryset = self.fields["import_requirements"].queryset.filter( self.fields["import_requirements"].queryset = self.fields["import_requirements"].queryset.filter(
event=self.initial["import_event"]) 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 # pylint: disable=import-outside-toplevel
# Local imports used to prevent cyclic imports and to only import when AKDashboard is available # Local imports used to prevent cyclic imports and to only import when AKDashboard is available
......
# Generated by Django 4.2.13 on 2025-02-25 20:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0060_orga_message_resolved'),
]
operations = [
migrations.CreateModel(
name='AKType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Name describing the type', max_length=128, verbose_name='Name')),
('event', models.ForeignKey(help_text='Associated event', on_delete=django.db.models.deletion.CASCADE, to='AKModel.event', verbose_name='Event')),
],
options={
'verbose_name': 'AK Type',
'verbose_name_plural': 'AK Types',
'ordering': ['name'],
'unique_together': {('event', 'name')},
},
),
migrations.AddField(
model_name='ak',
name='types',
field=models.ManyToManyField(blank=True, help_text='This AK is', to='AKModel.aktype', verbose_name='Types'),
),
]
# Generated by Django 4.2.13 on 2025-02-26 22:35
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0061_types'),
]
operations = [
migrations.RemoveField(
model_name='historicalak',
name='interest',
),
]
# Generated by Django 4.2.13 on 2025-03-03 19:59
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0062_interest_no_history'),
]
operations = [
migrations.AlterField(
model_name='ak',
name='name',
field=models.CharField(help_text='Name of the AK', max_length=256, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+'), django.core.validators.RegexValidator(message='Must contain at least one letter or digit', regex='[\\w\\s]+')], verbose_name='Name'),
),
migrations.AlterField(
model_name='ak',
name='short_name',
field=models.CharField(blank=True, help_text='Name displayed in the schedule', max_length=64, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+')], verbose_name='Short Name'),
),
migrations.AlterField(
model_name='akowner',
name='name',
field=models.CharField(help_text='Name to identify an AK owner by', max_length=64, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+'), django.core.validators.RegexValidator(message='Must contain at least one letter or digit', regex='[\\w\\s]+')], verbose_name='Nickname'),
),
migrations.AlterField(
model_name='historicalak',
name='name',
field=models.CharField(help_text='Name of the AK', max_length=256, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+'), django.core.validators.RegexValidator(message='Must contain at least one letter or digit', regex='[\\w\\s]+')], verbose_name='Name'),
),
migrations.AlterField(
model_name='historicalak',
name='short_name',
field=models.CharField(blank=True, help_text='Name displayed in the schedule', max_length=64, validators=[django.core.validators.RegexValidator(inverse_match=True, message='May not contain quotation marks', regex='[\'\\"´`]+')], verbose_name='Short Name'),
),
]
import itertools import itertools
from datetime import timedelta from datetime import datetime, timedelta
from django.db import models from django.core.validators import RegexValidator
from django.apps import apps from django.apps import apps
from django.db import models
from django.db.models import Count from django.db.models import Count
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils import timezone from django.utils import timezone
from django.utils.datetime_safe import datetime
from django.utils.text import slugify from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from simple_history.models import HistoricalRecords from simple_history.models import HistoricalRecords
from timezone_field import TimeZoneField from timezone_field import TimeZoneField
# Custom validators to be used for some of the fields
# Prevent inclusion of the quotation marks ' " ´ `
# This may be necessary to prevent javascript issues
no_quotation_marks_validator = RegexValidator(regex=r"['\"´`]+", inverse_match=True,
message=_('May not contain quotation marks'))
# Enforce that the field contains of at least one letter or digit (and not just special characters
# This prevents issues when autogenerating slugs from that field
slugable_validator = RegexValidator(regex=r"[\w\s]+", message=_('Must contain at least one letter or digit'))
class Event(models.Model): class Event(models.Model):
""" """
An event supplies the frame for all Aks. An event supplies the frame for all Aks.
...@@ -32,8 +42,9 @@ class Event(models.Model): ...@@ -32,8 +42,9 @@ class Event(models.Model):
help_text=_('When should AKs with intention to submit a resolution be done?')) help_text=_('When should AKs with intention to submit a resolution be done?'))
interest_start = models.DateTimeField(verbose_name=_('Interest Window Start'), blank=True, null=True, interest_start = models.DateTimeField(verbose_name=_('Interest Window Start'), blank=True, null=True,
help_text= help_text=
_('Opening time for expression of interest. When left blank, no interest indication will be possible.')) _('Opening time for expression of interest. When left blank, no interest '
'indication will be possible.'))
interest_end = models.DateTimeField(verbose_name=_('Interest Window End'), blank=True, null=True, interest_end = models.DateTimeField(verbose_name=_('Interest Window End'), blank=True, null=True,
help_text=_('Closing time for expression of interest.')) help_text=_('Closing time for expression of interest.'))
...@@ -45,7 +56,7 @@ class Event(models.Model): ...@@ -45,7 +56,7 @@ class Event(models.Model):
plan_hidden = models.BooleanField(verbose_name=_('Plan Hidden'), help_text=_('Hides plan for non-staff users'), plan_hidden = models.BooleanField(verbose_name=_('Plan Hidden'), help_text=_('Hides plan for non-staff users'),
default=True) default=True)
plan_published_at = models.DateTimeField(verbose_name=_('Plan published at'), blank=True, null=True, plan_published_at = models.DateTimeField(verbose_name=_('Plan published at'), blank=True, null=True,
help_text=_('Timestamp at which the plan was published')) help_text=_('Timestamp at which the plan was published'))
base_url = models.URLField(verbose_name=_("Base URL"), help_text=_("Prefix for wiki link construction"), blank=True) base_url = models.URLField(verbose_name=_("Base URL"), help_text=_("Prefix for wiki link construction"), blank=True)
wiki_export_template_name = models.CharField(verbose_name=_("Wiki Export Template Name"), blank=True, max_length=50) wiki_export_template_name = models.CharField(verbose_name=_("Wiki Export Template Name"), blank=True, max_length=50)
...@@ -53,8 +64,8 @@ class Event(models.Model): ...@@ -53,8 +64,8 @@ class Event(models.Model):
help_text=_('Default length in hours that is assumed for AKs in this event.')) help_text=_('Default length in hours that is assumed for AKs in this event.'))
contact_email = models.EmailField(verbose_name=_("Contact email address"), blank=True, contact_email = models.EmailField(verbose_name=_("Contact email address"), blank=True,
help_text=_("An email address that is displayed on every page " help_text=_("An email address that is displayed on every page "
"and can be used for all kinds of questions")) "and can be used for all kinds of questions"))
class Meta: class Meta:
verbose_name = _('Event') verbose_name = _('Event')
...@@ -85,7 +96,7 @@ class Event(models.Model): ...@@ -85,7 +96,7 @@ class Event(models.Model):
event = Event.objects.filter(active=True).order_by('start').first() event = Event.objects.filter(active=True).order_by('start').first()
# No active event? Return the next event taking place # No active event? Return the next event taking place
if event is None: if event is None:
event = Event.objects.order_by('start').filter(start__gt=datetime.now()).first() event = Event.objects.order_by('start').filter(start__gt=datetime.now().astimezone()).first()
return event return event
def get_categories_with_aks(self, wishes_seperately=False, def get_categories_with_aks(self, wishes_seperately=False,
...@@ -166,7 +177,9 @@ class Event(models.Model): ...@@ -166,7 +177,9 @@ class Event(models.Model):
class AKOwner(models.Model): class AKOwner(models.Model):
""" An AKOwner describes the person organizing/holding an AK. """ An AKOwner describes the person organizing/holding an AK.
""" """
name = models.CharField(max_length=64, verbose_name=_('Nickname'), help_text=_('Name to identify an AK owner by')) name = models.CharField(max_length=64, verbose_name=_('Nickname'),
validators=[no_quotation_marks_validator, slugable_validator],
help_text=_('Name to identify an AK owner by'))
slug = models.SlugField(max_length=64, blank=True, verbose_name=_('Slug'), help_text=_('Slug for URL generation')) slug = models.SlugField(max_length=64, blank=True, verbose_name=_('Slug'), help_text=_('Slug for URL generation'))
institution = models.CharField(max_length=128, blank=True, verbose_name=_('Institution'), help_text=_('Uni etc.')) institution = models.CharField(max_length=128, blank=True, verbose_name=_('Institution'), help_text=_('Uni etc.'))
link = models.URLField(blank=True, verbose_name=_('Web Link'), help_text=_('Link to Homepage')) link = models.URLField(blank=True, verbose_name=_('Web Link'), help_text=_('Link to Homepage'))
...@@ -245,8 +258,8 @@ class AKCategory(models.Model): ...@@ -245,8 +258,8 @@ class AKCategory(models.Model):
description = models.TextField(blank=True, verbose_name=_("Description"), description = models.TextField(blank=True, verbose_name=_("Description"),
help_text=_("Short description of this AK Category")) help_text=_("Short description of this AK Category"))
present_by_default = models.BooleanField(blank=True, default=True, verbose_name=_("Present by default"), present_by_default = models.BooleanField(blank=True, default=True, verbose_name=_("Present by default"),
help_text=_("Present AKs of this category by default " help_text=_("Present AKs of this category by default if AK owner did not "
"if AK owner did not specify whether this AK should be presented?")) "specify whether this AK should be presented?"))
event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'), event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
help_text=_('Associated event')) help_text=_('Associated event'))
...@@ -306,11 +319,32 @@ class AKRequirement(models.Model): ...@@ -306,11 +319,32 @@ class AKRequirement(models.Model):
return self.name return self.name
class AKType(models.Model):
""" An AKType allows to associate one or multiple types with an AK, e.g., to better describe the format of that AK
or to which group of people it is addressed. Types are specified per event and are an optional feature.
"""
name = models.CharField(max_length=128, verbose_name=_('Name'), help_text=_('Name describing the type'))
event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
help_text=_('Associated event'))
class Meta:
verbose_name = _('AK Type')
verbose_name_plural = _('AK Types')
ordering = ['name']
unique_together = ['event', 'name']
def __str__(self):
return self.name
class AK(models.Model): class AK(models.Model):
""" An AK is a slot-based activity to be scheduled during an event. """ An AK is a slot-based activity to be scheduled during an event.
""" """
name = models.CharField(max_length=256, verbose_name=_('Name'), help_text=_('Name of the AK')) name = models.CharField(max_length=256, verbose_name=_('Name'), help_text=_('Name of the AK'),
validators=[no_quotation_marks_validator, slugable_validator])
short_name = models.CharField(max_length=64, blank=True, verbose_name=_('Short Name'), short_name = models.CharField(max_length=64, blank=True, verbose_name=_('Short Name'),
validators=[no_quotation_marks_validator],
help_text=_('Name displayed in the schedule')) help_text=_('Name displayed in the schedule'))
description = models.TextField(blank=True, verbose_name=_('Description'), help_text=_('Description of the AK')) description = models.TextField(blank=True, verbose_name=_('Description'), help_text=_('Description of the AK'))
...@@ -323,6 +357,8 @@ class AK(models.Model): ...@@ -323,6 +357,8 @@ class AK(models.Model):
category = models.ForeignKey(to=AKCategory, on_delete=models.PROTECT, verbose_name=_('Category'), category = models.ForeignKey(to=AKCategory, on_delete=models.PROTECT, verbose_name=_('Category'),
help_text=_('Category of the AK')) help_text=_('Category of the AK'))
types = models.ManyToManyField(to=AKType, blank=True, verbose_name=_('Types'),
help_text=_("This AK is"))
track = models.ForeignKey(to=AKTrack, blank=True, on_delete=models.SET_NULL, null=True, verbose_name=_('Track'), track = models.ForeignKey(to=AKTrack, blank=True, on_delete=models.SET_NULL, null=True, verbose_name=_('Track'),
help_text=_('Track the AK belongs to')) help_text=_('Track the AK belongs to'))
...@@ -340,8 +376,8 @@ class AK(models.Model): ...@@ -340,8 +376,8 @@ class AK(models.Model):
help_text=_('AKs that should precede this AK in the schedule')) help_text=_('AKs that should precede this AK in the schedule'))
notes = models.TextField(blank=True, verbose_name=_('Organizational Notes'), help_text=_( notes = models.TextField(blank=True, verbose_name=_('Organizational Notes'), help_text=_(
'Notes to organizers. These are public. For private notes, please use the button for private messages ' '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).')) 'on the detail page of this AK (after creation/editing).'))
interest = models.IntegerField(default=-1, verbose_name=_('Interest'), help_text=_('Expected number of people')) interest = models.IntegerField(default=-1, verbose_name=_('Interest'), help_text=_('Expected number of people'))
interest_counter = models.IntegerField(default=0, verbose_name=_('Interest Counter'), interest_counter = models.IntegerField(default=0, verbose_name=_('Interest Counter'),
...@@ -353,7 +389,7 @@ class AK(models.Model): ...@@ -353,7 +389,7 @@ class AK(models.Model):
include_in_export = models.BooleanField(default=True, verbose_name=_('Export?'), include_in_export = models.BooleanField(default=True, verbose_name=_('Export?'),
help_text=_("Include AK in wiki export?")) help_text=_("Include AK in wiki export?"))
history = HistoricalRecords(excluded_fields=['interest_counter', 'include_in_export']) history = HistoricalRecords(excluded_fields=['interest', 'interest_counter', 'include_in_export'])
class Meta: class Meta:
verbose_name = _('AK') verbose_name = _('AK')
...@@ -385,8 +421,24 @@ class AK(models.Model): ...@@ -385,8 +421,24 @@ class AK(models.Model):
{_('Interest')}: {self.interest}""" {_('Interest')}: {self.interest}"""
if self.requirements.count() > 0: if self.requirements.count() > 0:
detail_string += f"\n{_('Requirements')}: {', '.join(str(r) for r in self.requirements.all())}" detail_string += f"\n{_('Requirements')}: {', '.join(str(r) for r in self.requirements.all())}"
if self.types.count() > 0:
detail_string += f"\n{_('Types')}: {', '.join(str(r) for r in self.types.all())}"
# Find conflicts
# (both directions, those specified for this AK and those were this AK was specified as conflict)
# Deduplicate and order list alphabetically
conflicts = set()
if self.conflicts.count() > 0: if self.conflicts.count() > 0:
detail_string += f"\n{_('Conflicts')}: {', '.join(str(c) for c in self.conflicts.all())}" for c in self.conflicts.all():
conflicts.add(str(c))
if self.conflict.count() > 0:
for c in self.conflict.all():
conflicts.add(str(c))
if len(conflicts) > 0:
conflicts = list(conflicts)
conflicts.sort()
detail_string += f"\n{_('Conflicts')}: {', '.join(conflicts)}"
if self.prerequisites.count() > 0: if self.prerequisites.count() > 0:
detail_string += f"\n{_('Prerequisites')}: {', '.join(str(p) for p in self.prerequisites.all())}" detail_string += f"\n{_('Prerequisites')}: {', '.join(str(p) for p in self.prerequisites.all())}"
detail_string += f"\n{_('Availabilities')}: \n{availabilities}" detail_string += f"\n{_('Availabilities')}: \n{availabilities}"
...@@ -466,7 +518,7 @@ class AK(models.Model): ...@@ -466,7 +518,7 @@ class AK(models.Model):
return reverse_lazy('submit:ak_detail', kwargs={'event_slug': self.event.slug, 'pk': self.id}) return reverse_lazy('submit:ak_detail', kwargs={'event_slug': self.event.slug, 'pk': self.id})
return self.edit_url return self.edit_url
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): def save(self, *args, force_insert=False, force_update=False, using=None, update_fields=None):
# Auto-Generate Link if not set yet # Auto-Generate Link if not set yet
if self.link == "": if self.link == "":
link = self.event.base_url + self.name.replace(" ", "_") link = self.event.base_url + self.name.replace(" ", "_")
...@@ -475,7 +527,8 @@ class AK(models.Model): ...@@ -475,7 +527,8 @@ class AK(models.Model):
# Tell Django that we have updated the link field # Tell Django that we have updated the link field
if update_fields is not None: if update_fields is not None:
update_fields = {"link"}.union(update_fields) update_fields = {"link"}.union(update_fields)
super().save(force_insert, force_update, using, update_fields) super().save(*args,
force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields)
class Room(models.Model): class Room(models.Model):
...@@ -592,7 +645,7 @@ class AKSlot(models.Model): ...@@ -592,7 +645,7 @@ class AKSlot(models.Model):
def overlaps(self, other: "AKSlot"): def overlaps(self, other: "AKSlot"):
""" """
Check wether two slots overlap Check whether two slots overlap
:param other: second slot to compare with :param other: second slot to compare with
:return: true if they overlap, false if not: :return: true if they overlap, false if not:
...@@ -600,13 +653,14 @@ class AKSlot(models.Model): ...@@ -600,13 +653,14 @@ class AKSlot(models.Model):
""" """
return self.start < other.end <= self.end or self.start <= other.start < self.end return self.start < other.end <= self.end or self.start <= other.start < self.end
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): def save(self, *args, force_insert=False, force_update=False, using=None, update_fields=None):
# Make sure duration is not longer than the event # Make sure duration is not longer than the event
if update_fields is None or 'duration' in update_fields: if update_fields is None or 'duration' in update_fields:
event_duration = self.event.end - self.event.start event_duration = self.event.end - self.event.start
event_duration_hours = event_duration.days * 24 + event_duration.seconds // 3600 event_duration_hours = event_duration.days * 24 + event_duration.seconds // 3600
self.duration = min(self.duration, event_duration_hours) self.duration = min(self.duration, event_duration_hours)
super().save(force_insert, force_update, using, update_fields) super().save(*args,
force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields)
class AKOrgaMessage(models.Model): class AKOrgaMessage(models.Model):
...@@ -641,6 +695,7 @@ class ConstraintViolation(models.Model): ...@@ -641,6 +695,7 @@ class ConstraintViolation(models.Model):
Depending on the type, different fields (references to other models) will be filled. Each violation should always Depending on the type, different fields (references to other models) will be filled. Each violation should always
be related to an event and at least on other instance of a causing entity be related to an event and at least on other instance of a causing entity
""" """
class Meta: class Meta:
verbose_name = _('Constraint Violation') verbose_name = _('Constraint Violation')
verbose_name_plural = _('Constraint Violations') verbose_name_plural = _('Constraint Violations')
...@@ -657,7 +712,7 @@ class ConstraintViolation(models.Model): ...@@ -657,7 +712,7 @@ class ConstraintViolation(models.Model):
AK_CONFLICT_COLLISION = 'acc', _('AK Slot is scheduled at the same time as an AK listed as a conflict') AK_CONFLICT_COLLISION = 'acc', _('AK Slot is scheduled at the same time as an AK listed as a conflict')
AK_BEFORE_PREREQUISITE = 'abp', _('AK Slot is scheduled before an AK listed as a prerequisite') AK_BEFORE_PREREQUISITE = 'abp', _('AK Slot is scheduled before an AK listed as a prerequisite')
AK_AFTER_RESODEADLINE = 'aar', _( AK_AFTER_RESODEADLINE = 'aar', _(
'AK Slot for AK with intention to submit a resolution is scheduled after resolution deadline') 'AK Slot for AK with intention to submit a resolution is scheduled after resolution deadline')
AK_CATEGORY_MISMATCH = 'acm', _('AK Slot in a category is outside that categories availabilities') AK_CATEGORY_MISMATCH = 'acm', _('AK Slot in a category is outside that categories availabilities')
AK_SLOT_COLLISION = 'asc', _('Two AK Slots for the same AK scheduled at the same time') AK_SLOT_COLLISION = 'asc', _('Two AK Slots for the same AK scheduled at the same time')
ROOM_CAPACITY_EXCEEDED = 'rce', _('Room does not have enough space for interest in scheduled AK Slot') ROOM_CAPACITY_EXCEEDED = 'rce', _('Room does not have enough space for interest in scheduled AK Slot')
...@@ -858,6 +913,7 @@ class DefaultSlot(models.Model): ...@@ -858,6 +913,7 @@ class DefaultSlot(models.Model):
Model representing a default slot, Model representing a default slot,
i.e., a prefered slot to use for typical AKs in the schedule to guarantee enough breaks etc. i.e., a prefered slot to use for typical AKs in the schedule to guarantee enough breaks etc.
""" """
class Meta: class Meta:
verbose_name = _('Default Slot') verbose_name = _('Default Slot')
verbose_name_plural = _('Default Slots') verbose_name_plural = _('Default Slots')
...@@ -870,7 +926,8 @@ class DefaultSlot(models.Model): ...@@ -870,7 +926,8 @@ class DefaultSlot(models.Model):
help_text=_('Associated event')) help_text=_('Associated event'))
primary_categories = models.ManyToManyField(to=AKCategory, verbose_name=_('Primary categories'), blank=True, primary_categories = models.ManyToManyField(to=AKCategory, verbose_name=_('Primary categories'), blank=True,
help_text=_('Categories that should be assigned to this slot primarily')) help_text=_(
'Categories that should be assigned to this slot primarily'))
@property @property
def start_simplified(self) -> str: def start_simplified(self) -> str:
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
{% block content %} {% block content %}
<pre> <pre>
title;duration;who;requirements;prerequisites;conflicts;availabilities;category;track;reso;notes; title;duration;who;requirements;prerequisites;conflicts;availabilities;category;types;track;reso;notes;
{% for slot in slots %}{{ slot.ak.short_name }};{{ slot.duration }};{{ slot.ak.owners.all|join:", " }};{{ slot.ak.requirements.all|join:", " }};{{ slot.ak.prerequisites.all|join:", " }};{{ slot.ak.conflicts.all|join:", " }};{% for a in slot.ak.availabilities.all %}{{ a.start | timezone:event.timezone | date:"l H:i" }} - {{ a.end | timezone:event.timezone | date:"l H:i" }}, {% endfor %};{{ slot.ak.category }};{{ slot.ak.track }};{{ slot.ak.reso }};{{ slot.ak.notes }}; {% for slot in slots %}{{ slot.ak.short_name }};{{ slot.duration }};{{ slot.ak.owners.all|join:", " }};{{ slot.ak.requirements.all|join:", " }};{{ slot.ak.prerequisites.all|join:", " }};{{ slot.ak.conflicts.all|join:", " }};{% for a in slot.ak.availabilities.all %}{{ a.start | timezone:event.timezone | date:"l H:i" }} - {{ a.end | timezone:event.timezone | date:"l H:i" }}, {% endfor %};{{ slot.ak.category }};{{ slot.ak.types.all|join:", " }};{{ slot.ak.track }};{{ slot.ak.reso }};{{ slot.ak.notes }};
{% endfor %} {% endfor %}
</pre> </pre>
{% endblock %} {% endblock %}
{% extends "admin/base_site.html" %}
{% load tags_AKModel %}
{% load i18n %}
{% load tz %}
{% load fontawesome_6 %}
{% block title %}{% trans "AKs by Owner" %}: {{owner}}{% endblock %}
{% block content %}
{% timezone event.timezone %}
<h2>[{{event}}] <a href="{% url 'admin:AKModel_akowner_change' owner.pk %}">{{owner}}</a> - {% trans "AKs" %}</h2>
<div class="row mt-4">
<table class="table table-striped">
{% for ak in owner.ak_set.all %}
<tr>
<td>{{ ak }}</td>
{% if "AKSubmission"|check_app_installed %}
<td class="text-end">
<a href="{{ ak.detail_url }}" data-bs-toggle="tooltip"
title="{% trans 'Details' %}"
class="btn btn-primary">{% fa6_icon 'info' 'fas' %}</a>
{% if event.active %}
<a href="{{ ak.edit_url }}" data-bs-toggle="tooltip"
title="{% trans 'Edit' %}"
class="btn btn-success">{% fa6_icon 'pencil-alt' 'fas' %}</a>
{% endif %}
{% endif %}
</td>
</tr>
{% empty %}
<tr><td>{% trans "This user does not have any AKs currently" %}</td></tr>
{% endfor %}
</table>
</div>
{% endtimezone %}
{% endblock %}
...@@ -3,8 +3,11 @@ from django.apps import apps ...@@ -3,8 +3,11 @@ from django.apps import apps
from django.conf import settings from django.conf import settings
from django.utils.html import format_html, mark_safe, conditional_escape from django.utils.html import format_html, mark_safe, conditional_escape
from django.templatetags.static import static from django.templatetags.static import static
from django.template.defaultfilters import date
from fontawesome_6.app_settings import get_css from fontawesome_6.app_settings import get_css
from AKModel.models import Event
register = template.Library() register = template.Library()
...@@ -71,6 +74,21 @@ def wiki_owners_export(owners, event): ...@@ -71,6 +74,21 @@ def wiki_owners_export(owners, event):
return ", ".join(to_link(owner) for owner in owners.all()) return ", ".join(to_link(owner) for owner in owners.all())
@register.filter
def event_month_year(event:Event):
"""
Print rough event date (month and year)
:param event: event to print the date for
:return: string containing rough date information for event
"""
if event.start.month == event.end.month:
return f"{date(event.start, 'F')} {event.start.year}"
event_start_string = date(event.start, 'F')
if event.start.year != event.end.year:
event_start_string = f"{event_start_string} {event.start.year}"
return f"{event_start_string} - {date(event.end, 'F')} {event.end.year}"
# get list of relevant css fontawesome css files for this instance # get list of relevant css fontawesome css files for this instance
css = get_css() css = get_css()
......