Skip to content
Snippets Groups Projects
Commit 99b0601e authored by Felix Schäfer's avatar Felix Schäfer :construction_worker:
Browse files

Cache the html head

parent ec7a5567
No related branches found
No related tags found
No related merge requests found
...@@ -11,12 +11,16 @@ from pretix.base.models import OrderPosition ...@@ -11,12 +11,16 @@ from pretix.base.models import OrderPosition
@receiver(html_head, dispatch_uid="public_registrations_html_head") @receiver(html_head, dispatch_uid="public_registrations_html_head")
def add_public_registrations_html_head(sender, request=None, **kwargs): def add_public_registrations_html_head(sender, request=None, **kwargs):
url = resolve(request.path_info) cached = sender.cache.get('public_registrations_html_head')
if "event.index" in url.url_name: if cached is None:
template = get_template("pretix_public_registrations/head.html") url = resolve(request.path_info)
return template.render() if "event.index" in url.url_name:
else: template = get_template("pretix_public_registrations/head.html")
return "" cached = template.render()
else:
cached = ""
sender.cache.set('public_registrations_html_head', cached)
return cached
@receiver(question_form_fields, dispatch_uid="public_registration_question") @receiver(question_form_fields, dispatch_uid="public_registration_question")
......
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