Add request to organizer_edit_tabs signal and actually send it

This commit is contained in:
Raphael Michel
2017-01-27 11:08:52 +01:00
parent 123f47ab39
commit ba455a3630
3 changed files with 11 additions and 3 deletions

View File

@@ -124,12 +124,13 @@ As with all plugin signals, the ``sender`` keyword argument will contain the eve
""" """
organizer_edit_tabs = Signal( organizer_edit_tabs = Signal(
providing_args=['organizer'] providing_args=['organizer', 'request']
) )
""" """
This signal is sent out to include tabs on the detail page of an organizer. Receivers This signal is sent out to include tabs on the detail page of an organizer. Receivers
should return a tuple with the first item being the tab title and the second item should return a tuple with the first item being the tab title and the second item
being the content as HTML. The receivers get the ``organizer`` as a keyword argument. being the content as HTML. The receivers get the ``organizer`` and the ``request`` as
keyword arguments.
This is a regular django signal (no pretix event signal). This is a regular django signal (no pretix event signal).
""" """

View File

@@ -151,7 +151,7 @@
{% for title, content in tabs %} {% for title, content in tabs %}
<div class="tab-pane" id="tab-{{ forloop.index }}"> <div class="tab-pane" id="tab-{{ forloop.index }}">
<div class="tab-inner"> <div class="tab-inner">
{{ field }} {{ content }}
</div> </div>
</div> </div>
{% endfor %} {% endfor %}

View File

@@ -14,6 +14,7 @@ from pretix.base.models import Organizer, OrganizerPermission, User
from pretix.base.services.mail import SendMailException, mail from pretix.base.services.mail import SendMailException, mail
from pretix.control.forms.organizer import OrganizerForm, OrganizerUpdateForm from pretix.control.forms.organizer import OrganizerForm, OrganizerUpdateForm
from pretix.control.permissions import OrganizerPermissionRequiredMixin from pretix.control.permissions import OrganizerPermissionRequiredMixin
from pretix.control.signals import organizer_edit_tabs
from pretix.helpers.urls import build_absolute_uri from pretix.helpers.urls import build_absolute_uri
@@ -74,6 +75,12 @@ class OrganizerDetail(OrganizerPermissionRequiredMixin, DetailView):
ctx['formset'] = self.formset ctx['formset'] = self.formset
ctx['add_form'] = self.add_form ctx['add_form'] = self.add_form
ctx['events'] = self.request.organizer.events.all() ctx['events'] = self.request.organizer.events.all()
ctx['tabs'] = []
for recv, retv in organizer_edit_tabs.send(sender=self.request.organizer, request=self.request,
organizer=self.request.organizer):
ctx['tabs'].append(retv)
return ctx return ctx
def _send_invite(self, instance): def _send_invite(self, instance):