mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Splitted URL configuration for main and subdomains
This commit is contained in:
@@ -21,20 +21,23 @@ def eventreverse(event, name, kwargs=None):
|
||||
Works similar to django.core.urlresolvers.reverse but takes into account that some
|
||||
organizers might have their own (sub)domain instead of a subpath.
|
||||
"""
|
||||
from pretix.multidomain import subdomain_urlconf, maindomain_urlconf
|
||||
|
||||
kwargs = kwargs or {}
|
||||
kwargs['event'] = event.slug
|
||||
domain = get_domain(event)
|
||||
if domain:
|
||||
if 'organizer' in kwargs:
|
||||
del kwargs['organizer']
|
||||
path = reverse(name, kwargs=kwargs)
|
||||
|
||||
path = reverse(name, kwargs=kwargs, urlconf=subdomain_urlconf)
|
||||
siteurlsplit = urlsplit(settings.SITE_URL)
|
||||
if siteurlsplit.port and siteurlsplit.port not in (80, 443):
|
||||
domain = '%s:%d' % (domain, siteurlsplit.port)
|
||||
return urljoin('%s://%s' % (siteurlsplit.scheme, domain), path)
|
||||
|
||||
kwargs['organizer'] = event.organizer.slug
|
||||
return reverse(name, kwargs=kwargs)
|
||||
return reverse(name, kwargs=kwargs, urlconf=maindomain_urlconf)
|
||||
|
||||
|
||||
def build_absolute_uri(event, urlname, kwargs=None):
|
||||
|
||||
Reference in New Issue
Block a user