Add new signal nav_item

This commit is contained in:
Raphael Michel
2019-06-14 12:20:06 +02:00
parent 44bef85b66
commit 1ce613ff89
4 changed files with 39 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ from pretix.control.forms.item import (
from pretix.control.permissions import (
EventPermissionRequiredMixin, event_permission_required,
)
from pretix.control.signals import item_forms
from pretix.control.signals import item_forms, nav_item
from . import ChartContainingView, CreateView, PaginationMixin, UpdateView
@@ -782,6 +782,18 @@ class ItemDetailMixin(SingleObjectMixin):
model = Item
context_object_name = 'item'
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
nav = sorted(
sum(
(list(a[1]) for a in nav_item.send(self.request.event, request=self.request, item=self.get_object())),
[]
),
key=lambda r: str(r['label'])
)
ctx['extra_nav'] = nav
return ctx
def get_object(self, queryset=None) -> Item:
try:
if not hasattr(self, 'object') or not self.object: