Skip to content
Snippets Groups Projects
Commit 35f54089 authored by Nadja Geisler's avatar Nadja Geisler :sunny:
Browse files

Merge branch 'fix-interest-view' into 'main'

Improve interest entering view

See merge request kif/akplanning!131
parents e9c5be55 903ce570
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment