diff --git a/AKModel/admin.py b/AKModel/admin.py index aed7621171fa90bc4cb55c50296d2c09cd3c7d13..ae8da12f3a60f47c64cb21b6611ead2b7b099059 100644 --- a/AKModel/admin.py +++ b/AKModel/admin.py @@ -171,7 +171,7 @@ class AKAdmin(SimpleHistoryAdmin): model = AK 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', 'interest_counter'] + list_editable = ['short_name', 'track', 'interest_counter'] ordering = ['pk'] actions = ['wiki_export'] form = AKAdminForm diff --git a/AKScheduling/views.py b/AKScheduling/views.py index 0e7c1ac7a4a771ad092be6a491d10d8a07d1b252..47781cf09759413509c7c517bc79ee0aaf00025f 100644 --- a/AKScheduling/views.py +++ b/AKScheduling/views.py @@ -120,9 +120,15 @@ class InterestEnteringAdminView(SuccessMessageMixin, AdminViewMixin, EventSlugMi context["next_ak"] = None last_ak = None next_is_next = False - for other_ak in context['ak'].category.ak_set.all(): - if other_ak.wish: - continue + + # Find other AK wishes (regardless of the category)... + if context['ak'].wish: + other_aks = [ak for ak in context['event'].ak_set.all() if ak.wish] + # or other AKs of this category + else: + other_aks = [ak for ak in context['ak'].category.ak_set.all() if not ak.wish] + + for other_ak in other_aks: if next_is_next: context['next_ak'] = other_ak next_is_next = False @@ -140,6 +146,7 @@ class InterestEnteringAdminView(SuccessMessageMixin, AdminViewMixin, EventSlugMi aks_for_category.append(ak) categories_with_aks.append((category, aks_for_category)) + ak_wishes.sort(key=lambda x: x.pk) categories_with_aks.append( (AKCategory(name=_("Wishes"), pk=0, description="-"), ak_wishes))