Allow to access not-yet-live shop on different domain

This commit is contained in:
Raphael Michel
2017-01-05 11:50:10 +01:00
parent f6d8b825d5
commit d3f21353ca
5 changed files with 82 additions and 9 deletions

View File

@@ -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)