From acb8bebc8d5d9b580244e3c010a1699a6908ba7d Mon Sep 17 00:00:00 2001 From: Kristoffer Rath Hansen Date: Sun, 14 Jan 2024 16:44:09 +0100 Subject: [PATCH] make sure membership activities are ordered correctly --- members/management/commands/create_membership_activities.py | 4 ++-- members/views/Membership.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/members/management/commands/create_membership_activities.py b/members/management/commands/create_membership_activities.py index c7fd6008..3c409963 100644 --- a/members/management/commands/create_membership_activities.py +++ b/members/management/commands/create_membership_activities.py @@ -26,13 +26,13 @@ def handle(self, *args, **options): localDepartments = str.join( ", ", - Department.objects.filter(union=curUnion).values_list( + Department.objects.filter(union=curUnion, closed_dtm=None).values_list( "name", flat=True ), ) try: - department = Department.objects.get(name=localDepartments) + department = Department.objects.get(name=curUnion.name) except Exception: print("Using backup main department at %s" % (curUnion.name)) pass diff --git a/members/views/Membership.py b/members/views/Membership.py index 85b5ba95..5734291b 100644 --- a/members/views/Membership.py +++ b/members/views/Membership.py @@ -21,7 +21,7 @@ def Membership(request): current_activities = Activity.objects.filter( signup_closing__gte=timezone.now(), activitytype__in=["FORENINGSMEDLEMSKAB"], - ).order_by("department__address__region", "-name", "start_date") + ).order_by("department__union__address__region", "name", "start_date") family = None participating = None