mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Add signal html_page_start
This commit is contained in:
@@ -25,3 +25,22 @@ def eventsignal(event: Event, signame: str, **kwargs):
|
||||
if response:
|
||||
_html.append(response)
|
||||
return mark_safe("".join(_html))
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def signal(signame: str, request, **kwargs):
|
||||
"""
|
||||
Send a signal and return the concatenated return values of all responses.
|
||||
|
||||
Usage::
|
||||
|
||||
{% signal request "path.to.signal" argument="value" ... %}
|
||||
"""
|
||||
sigstr = signame.rsplit('.', 1)
|
||||
sigmod = importlib.import_module(sigstr[0])
|
||||
signal = getattr(sigmod, sigstr[1])
|
||||
_html = []
|
||||
for receiver, response in signal.send(request, **kwargs):
|
||||
if response:
|
||||
_html.append(response)
|
||||
return mark_safe("".join(_html))
|
||||
|
||||
@@ -12,6 +12,16 @@ This signal is sent out to build configuration forms for all restriction formset
|
||||
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
|
||||
html_page_start = Signal(
|
||||
providing_args=[]
|
||||
)
|
||||
"""
|
||||
This signal allows you to put code in the beginning of the main page for every
|
||||
page in the backend. You are expected to return HTML.
|
||||
|
||||
The ``sender`` keyword argument will contain the request.
|
||||
"""
|
||||
|
||||
html_head = EventPluginSignal(
|
||||
providing_args=["request"]
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
{% load i18n %}
|
||||
{% load hijack_tags %}
|
||||
{% load statici18n %}
|
||||
{% load eventsignal %}
|
||||
{% load eventurl %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -329,6 +330,7 @@
|
||||
{% endif %}
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
{% signal "pretix.control.signals.html_page_start" request %}
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div class="alert {{ message.tags }}">
|
||||
|
||||
Reference in New Issue
Block a user