From 4b2bbc470bcd0aca4b605e06b2ef8d84bda0861c Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 15 Mar 2023 19:26:06 +0100 Subject: [PATCH 1/4] events: Fix last day of web calendar for full-day event In the events model, an event with an end_date but without an end_time is meant to include the last day. Fullcalendar.io, which is used for the web calendar, however, always regards the end datetime as exclusive. Add a day in the case that we have no end_time, so that the web calender includes the last day in the display. --- mpicms/events/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mpicms/events/models.py b/mpicms/events/models.py index 72d8c9c..819aca5 100644 --- a/mpicms/events/models.py +++ b/mpicms/events/models.py @@ -1,5 +1,5 @@ import json -from datetime import datetime, date +from datetime import datetime, date, timedelta from ics import Calendar, Event as ICSEvent from django.db import models @@ -71,10 +71,15 @@ def end(self): return self.end_date def get_dict(self, request=None): + + datetime_end = self.end + if self.end_date and not self.end_time: + datetime_end += timedelta(days = 1) + return { 'title': self.title, 'start': self.start.isoformat(), - 'end': self.end.isoformat() if self.end else None, + 'end': datetime_end.isoformat() if self.end else None, 'url': self.get_url(request=request), } From f36e0845f0625272c993f8d06ab675de3b32fb97 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sat, 8 Jan 2022 18:47:48 +0100 Subject: [PATCH 2/4] personal: Remove development relicts --- mpicms/personal/wagtail_hooks.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/mpicms/personal/wagtail_hooks.py b/mpicms/personal/wagtail_hooks.py index d82fd56..0548aa9 100644 --- a/mpicms/personal/wagtail_hooks.py +++ b/mpicms/personal/wagtail_hooks.py @@ -86,5 +86,3 @@ class ContactGroup(ModelAdminGroup): modeladmin_register(ContactGroup) -# modeladmin_register(ContactAdmin) -# modeladmin_register(GroupAdmin) From e722229661bacfb6ceabf2ddafb0f6cb4281eff8 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 15 Mar 2023 19:45:17 +0100 Subject: [PATCH 3/4] Update translations Commit fe8b55ee ("publications: Apply flake8 hint fixes") changed some line numbers. Update translations with ./manage.py makemessages -l de --ignore bla/lib/python3.7/site-packages/xlwt --- locale/de/LC_MESSAGES/django.po | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 1ce0823..dd3ddb0 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-08-02 10:50+0200\n" +"POT-Creation-Date: 2023-03-15 19:43+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1697,7 +1697,7 @@ msgstr "" #: bla/lib/python3.7/site-packages/wagtailvideos/models.py:84 #: mpicms/base/models.py:46 mpicms/personal/models.py:68 -#: mpicms/personal/models.py:95 mpicms/publications/models.py:23 +#: mpicms/personal/models.py:95 mpicms/publications/models.py:26 msgid "title" msgstr "Titel" @@ -2155,19 +2155,19 @@ msgstr "Raum" msgid "event dates" msgstr "Veranstaltungsdaten" -#: mpicms/events/models.py:96 +#: mpicms/events/models.py:101 msgid "event" msgstr "Veranstaltung" -#: mpicms/events/models.py:97 +#: mpicms/events/models.py:102 msgid "events" msgstr "Veranstaltungen" -#: mpicms/events/models.py:138 +#: mpicms/events/models.py:143 msgid "event index" msgstr "Veranstaltungs-Index" -#: mpicms/events/models.py:139 +#: mpicms/events/models.py:144 msgid "event indexes" msgstr "Veranstaltungs-Indexes" @@ -2192,7 +2192,7 @@ msgid "news entries" msgstr "Neuigkeiten" #: mpicms/personal/models.py:25 mpicms/personal/models.py:31 -#: mpicms/publications/models.py:24 +#: mpicms/publications/models.py:27 msgid "groups" msgstr "Gruppen" @@ -2259,11 +2259,11 @@ msgstr "Gruppen" msgid "Positions" msgstr "Positionen" -#: mpicms/publications/models.py:25 +#: mpicms/publications/models.py:28 msgid "authors" msgstr "Autoren" -#: mpicms/publications/models.py:26 +#: mpicms/publications/models.py:29 msgid "source" msgstr "Quellen" @@ -2386,7 +2386,7 @@ msgstr "Email-Adresse" msgid "Phone" msgstr "Telefon" -#: mpicms/templates/publications/components/list.html:25 +#: mpicms/templates/publications/components/list.html:24 msgid "More in PuRe" msgstr "Mehr in PuRe" From a199812c6e2cb7f9372ad6a3edbc49d2dd5d985e Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 15 Mar 2023 20:45:12 +0100 Subject: [PATCH 4/4] events: Remove extra "\n" from ics output We don't need to use "\n" joiners for the output of the ics.Calendar iterator, because the lines already contain "\r\n" termination. If fact, ics.Calendar.__str__() returns the calendar as an ics formated string, so just return the icx calendar itself. Newer versions of ics have better serialisation, but we don't want to complicate things by library updates now. --- mpicms/events/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpicms/events/models.py b/mpicms/events/models.py index 819aca5..f7347f5 100644 --- a/mpicms/events/models.py +++ b/mpicms/events/models.py @@ -136,7 +136,7 @@ def ics(self): if type(event.start) is date: e.make_all_day() c.events.add(e) - return '\n'.join(c) + return c class Meta: # noqa