fix(members): move util function, remove blank space

pull/154/head
mariusrklein 5 months ago
parent b0fb7bcfce
commit eb2cd6c68c

@ -892,11 +892,6 @@ class GroupAdmin(CommonAdminMixin, admin.ModelAdmin):
}
return render_tex(f"Gruppen-Checkliste", 'members/group_checklist.tex', context)
def mondays_until_nth(n):
today = datetime.today()
next_monday = today + timedelta(days=(7 - today.weekday()) % 7 or 7)
return [(next_monday + timedelta(weeks=i)).date() for i in range(n + 1)]
class ActivityCategoryAdmin(admin.ModelAdmin):
fields = ['name', 'ljp_category', 'description']

@ -375,7 +375,6 @@ class Member(Person):
@property
def ticket_tag(self):
"""Returning the ticket number stripped of strings and spaces"""
return "{" + ''.join(re.findall(r'\d', self.ticket_no)) + "}"
@property

@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timedelta
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
@ -80,3 +80,11 @@ def normalize_filename(filename, append_date=True, date=None):
filename = filename.replace(' ', '_').replace('&', '').replace('/', '_')
# drop umlauts, accents etc.
return unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore').decode()
def mondays_until_nth(n):
""" Returns a list of dates for the next n Mondays, starting from the next Monday.
This functions aids in the generation of weekly schedules or reports."""
today = datetime.today()
next_monday = today + timedelta(days=(7 - today.weekday()) % 7 or 7)
return [(next_monday + timedelta(weeks=i)).date() for i in range(n + 1)]

Loading…
Cancel
Save