mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Allow to access not-yet-live shop on different domain
This commit is contained in:
@@ -3,12 +3,21 @@
|
||||
{% load eventurl %}
|
||||
{% block title %}{{ request.event.name }}{% endblock %}
|
||||
{% block content %}
|
||||
<h1>
|
||||
{{ request.event.name }}
|
||||
<a href="{% eventurl request.event "presale:event.index" %}" class="btn btn-default btn-sm" target="_blank">
|
||||
{% trans "Go to shop" %}
|
||||
</a>
|
||||
</h1>
|
||||
<form action="{% eventurl request.event "presale:event.auth" %}" method="post" target="_blank">
|
||||
<h1>
|
||||
{{ request.event.name }}
|
||||
{% if has_domain and not request.event.live %}
|
||||
<input type="hidden" value="{{ new_session }}" name="session">
|
||||
<button type="submit" class="btn btn-default btn-sm">
|
||||
{% trans "Go to shop" %}
|
||||
</button>
|
||||
{% else %}
|
||||
<a href="{% eventurl request.event "presale:event.index" %}" class="btn btn-default btn-sm" target="_blank">
|
||||
{% trans "Go to shop" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</h1>
|
||||
</form>
|
||||
|
||||
{% if actions|length > 0 %}
|
||||
<div class="panel panel-danger">
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from decimal import Decimal
|
||||
from importlib import import_module
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db.models import Sum
|
||||
@@ -17,6 +19,7 @@ from pretix.control.signals import (
|
||||
|
||||
from ..logdisplay import OVERVIEW_BLACKLIST
|
||||
|
||||
SessionStore = import_module(settings.SESSION_ENGINE).SessionStore
|
||||
NUM_WIDGET = '<div class="numwidget"><span class="num">{num}</span><span class="text">{text}</span></div>'
|
||||
|
||||
|
||||
@@ -167,11 +170,21 @@ def event_index(request, organizer, event):
|
||||
|
||||
a_qs = request.event.requiredaction_set.filter(done=False)
|
||||
|
||||
has_domain = request.event.organizer.domains.exists()
|
||||
|
||||
ctx = {
|
||||
'widgets': rearrange(widgets),
|
||||
'logs': qs[:5],
|
||||
'actions': a_qs[:5] if request.eventperm.can_change_orders else []
|
||||
'actions': a_qs[:5] if request.eventperm.can_change_orders else [],
|
||||
'has_domain': has_domain
|
||||
}
|
||||
|
||||
if not request.event.live and has_domain:
|
||||
s = SessionStore()
|
||||
s['pretix_event_access_{}'.format(request.event.pk)] = request.session.session_key
|
||||
s.create()
|
||||
ctx['new_session'] = s.session_key
|
||||
|
||||
for a in ctx['actions']:
|
||||
a.display = a.display(request)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user