Skip to content
Snippets Groups Projects
Commit ddc7010a 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 tags found
No related merge requests found
......@@ -169,9 +169,9 @@ class AKAdminForm(forms.ModelForm):
@admin.register(AK)
class AKAdmin(SimpleHistoryAdmin):
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', 'availabilities_total_duration']
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