forked from CGM_Public/pretix_original
Simplify the API for custom URLs
This commit is contained in:
@@ -20,7 +20,16 @@ presale_patterns_main = [
|
||||
raw_plugin_patterns = []
|
||||
for app in apps.get_app_configs():
|
||||
if hasattr(app, 'PretixPluginMeta'):
|
||||
if importlib.util.find_spec(app.name + '.maindomain_urls'):
|
||||
if importlib.util.find_spec(app.name + '.urls'):
|
||||
urlmod = importlib.import_module(app.name + '.urls')
|
||||
raw_plugin_patterns.append(
|
||||
url(r'', include(urlmod, namespace=app.label))
|
||||
)
|
||||
if hasattr(urlmod, 'event_patterns'):
|
||||
raw_plugin_patterns.append(
|
||||
url(r'^(?P<organizer>[^/]+)/(?P<event>[^/]+)/', include(urlmod.event_patterns, namespace=app.label))
|
||||
)
|
||||
elif importlib.util.find_spec(app.name + '.maindomain_urls'):
|
||||
urlmod = importlib.import_module(app.name + '.maindomain_urls')
|
||||
raw_plugin_patterns.append(
|
||||
url(r'', include(urlmod, namespace=app.label))
|
||||
|
||||
@@ -19,7 +19,13 @@ presale_patterns = [
|
||||
raw_plugin_patterns = []
|
||||
for app in apps.get_app_configs():
|
||||
if hasattr(app, 'PretixPluginMeta'):
|
||||
if importlib.util.find_spec(app.name + '.subdomain_urls'):
|
||||
if importlib.util.find_spec(app.name + '.urls'):
|
||||
urlmod = importlib.import_module(app.name + '.urls')
|
||||
if hasattr(urlmod, 'event_patterns'):
|
||||
raw_plugin_patterns.append(
|
||||
url(r'^(?P<event>[^/]+)/', include(urlmod.event_patterns, namespace=app.label))
|
||||
)
|
||||
elif importlib.util.find_spec(app.name + '.subdomain_urls'):
|
||||
urlmod = importlib.import_module(app.name + '.subdomain_urls')
|
||||
raw_plugin_patterns.append(
|
||||
url(r'', include(urlmod, namespace=app.label))
|
||||
|
||||
@@ -47,7 +47,7 @@ def eventurl(parser, token):
|
||||
"""
|
||||
bits = token.split_contents()
|
||||
if len(bits) < 3:
|
||||
raise TemplateSyntaxError("'%s' takes at least one argument, an event and the name of a url()." % bits[0])
|
||||
raise TemplateSyntaxError("'%s' takes at least two arguments, an event and the name of a url()." % bits[0])
|
||||
viewname = parser.compile_filter(bits[2])
|
||||
event = parser.compile_filter(bits[1])
|
||||
kwargs = {}
|
||||
|
||||
Reference in New Issue
Block a user