Skip to content
Snippets Groups Projects
Commit 903ce570 authored by Benjamin Hättasch's avatar Benjamin Hättasch
Browse files

Improve interest entering view

Previously, linking of next and previous AKs did not always work correctly for wishes
Also remove input for interest on AK list
parent e9c5be55
No related branches found
No related tags found
1 merge request!131Improve interest entering view
Pipeline #103007 passed
...@@ -171,7 +171,7 @@ class AKAdmin(SimpleHistoryAdmin): ...@@ -171,7 +171,7 @@ class AKAdmin(SimpleHistoryAdmin):
model = AK model = AK
list_display = ['name', 'short_name', 'category', 'track', 'is_wish', 'interest', 'interest_counter', 'event'] list_display = ['name', 'short_name', 'category', 'track', 'is_wish', 'interest', 'interest_counter', 'event']
list_filter = ['event', WishFilter, ('category', EventRelatedFieldListFilter), ('requirements', EventRelatedFieldListFilter)] 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'] ordering = ['pk']
actions = ['wiki_export'] actions = ['wiki_export']
form = AKAdminForm form = AKAdminForm
......
...@@ -120,9 +120,15 @@ class InterestEnteringAdminView(SuccessMessageMixin, AdminViewMixin, EventSlugMi ...@@ -120,9 +120,15 @@ class InterestEnteringAdminView(SuccessMessageMixin, AdminViewMixin, EventSlugMi
context["next_ak"] = None context["next_ak"] = None
last_ak = None last_ak = None
next_is_next = False next_is_next = False
for other_ak in context['ak'].category.ak_set.all():
if other_ak.wish: # Find other AK wishes (regardless of the category)...
continue 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: if next_is_next:
context['next_ak'] = other_ak context['next_ak'] = other_ak
next_is_next = False next_is_next = False
...@@ -140,6 +146,7 @@ class InterestEnteringAdminView(SuccessMessageMixin, AdminViewMixin, EventSlugMi ...@@ -140,6 +146,7 @@ class InterestEnteringAdminView(SuccessMessageMixin, AdminViewMixin, EventSlugMi
aks_for_category.append(ak) aks_for_category.append(ak)
categories_with_aks.append((category, aks_for_category)) categories_with_aks.append((category, aks_for_category))
ak_wishes.sort(key=lambda x: x.pk)
categories_with_aks.append( categories_with_aks.append(
(AKCategory(name=_("Wishes"), pk=0, description="-"), ak_wishes)) (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