From d981998a4008e3c464b2d0a40d88b9d6f5ad107f Mon Sep 17 00:00:00 2001
From: Raphael Michel
Date: Thu, 16 Apr 2015 09:35:18 +0200
Subject: [PATCH] Proper namespaces for plugin URLs
---
doc/development/api/plugins.rst | 3 ++-
src/pretix/plugins/banktransfer/signals.py | 4 ++--
src/pretix/plugins/banktransfer/urls.py | 2 +-
src/pretix/plugins/banktransfer/views.py | 2 +-
src/pretix/plugins/paypal/payment.py | 4 ++--
.../paypal/templates/pretixplugins/paypal/pending.html | 2 +-
src/pretix/plugins/paypal/views.py | 4 ++--
src/pretix/urls.py | 8 ++++++--
8 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/doc/development/api/plugins.rst b/doc/development/api/plugins.rst
index 1f33b0cacf..5b66470b73 100644
--- a/doc/development/api/plugins.rst
+++ b/doc/development/api/plugins.rst
@@ -94,7 +94,8 @@ Views
Your plugin may define custom views. If you put an ``urls`` submodule into your
plugin module, pretix will automatically import it and include it into the root
-URL configuration.
+URL configuration with the namespace ``plugins:
- {% trans "Try again" %}
+ {% trans "Try again" %}
{% else %}
{% blocktrans trimmed %}
diff --git a/src/pretix/plugins/paypal/views.py b/src/pretix/plugins/paypal/views.py
index 3d5714b391..afcd93f047 100644
--- a/src/pretix/plugins/paypal/views.py
+++ b/src/pretix/plugins/paypal/views.py
@@ -73,10 +73,10 @@ def retry(request, order):
"payment_method": "paypal",
},
"redirect_urls": {
- "return_url": request.build_absolute_uri(reverse('plugins:paypal.retry', kwargs={
+ "return_url": request.build_absolute_uri(reverse('plugins:paypal:retry', kwargs={
'order': order.code
})),
- "cancel_url": request.build_absolute_uri(reverse('plugins:paypal.retry', kwargs={
+ "cancel_url": request.build_absolute_uri(reverse('plugins:paypal:retry', kwargs={
'order': order.code
})),
},
diff --git a/src/pretix/urls.py b/src/pretix/urls.py
index bab437ac5a..14e437d500 100644
--- a/src/pretix/urls.py
+++ b/src/pretix/urls.py
@@ -21,15 +21,19 @@ if settings.DEBUG:
url(r'^__debug__/', include(debug_toolbar.urls)),
)
+pluginpatterns = []
for app in apps.get_app_configs():
if hasattr(app, 'PretixPluginMeta'):
try:
urlmod = importlib.import_module(app.name + '.urls')
- urlpatterns.append(
- url(r'', include(urlmod, namespace='plugins'))
+ pluginpatterns.append(
+ url(r'', include(urlmod, namespace=app.label))
)
except ImportError:
pass
+urlpatterns.append(
+ url(r'', include(pluginpatterns, namespace='plugins'))
+)
urlpatterns.append(
url(r'', include(pretix.presale.urls, namespace='presale'))