forked from CGM_Public/pretix_original
Proper namespaces for plugin URLs
This commit is contained in:
@@ -94,7 +94,8 @@ Views
|
|||||||
|
|
||||||
Your plugin may define custom views. If you put an ``urls`` submodule into your
|
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
|
plugin module, pretix will automatically import it and include it into the root
|
||||||
URL configuration.
|
URL configuration with the namespace ``plugins:<label>:``, where ``<label>`` is
|
||||||
|
your Django app label.
|
||||||
|
|
||||||
.. WARNING:: If you define custom URLs and views, you are currently on your own
|
.. WARNING:: If you define custom URLs and views, you are currently on your own
|
||||||
with checking that the calling user is logged in, has appropriate permissions,
|
with checking that the calling user is logged in, has appropriate permissions,
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ def control_nav_import(sender, request=None, **kwargs):
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'label': _('Import bank data'),
|
'label': _('Import bank data'),
|
||||||
'url': reverse('plugins:banktransfer.import', kwargs={
|
'url': reverse('plugins:banktransfer:import', kwargs={
|
||||||
'event': request.event.slug,
|
'event': request.event.slug,
|
||||||
'organizer': request.event.organizer.slug,
|
'organizer': request.event.organizer.slug,
|
||||||
}),
|
}),
|
||||||
'active': (url.namespace == 'plugins' and url.url_name == 'banktransfer.import'),
|
'active': (url.namespace == 'plugins:banktransfer' and url.url_name == 'import'),
|
||||||
'icon': 'upload',
|
'icon': 'upload',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ from .views import *
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/banktransfer/import/', ImportView.as_view(),
|
url(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/banktransfer/import/', ImportView.as_view(),
|
||||||
name='banktransfer.import'),
|
name='import'),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class ImportView(EventPermissionRequiredMixin, TemplateView):
|
|||||||
})
|
})
|
||||||
|
|
||||||
def redirect_back(self):
|
def redirect_back(self):
|
||||||
return redirect(reverse('plugins:banktransfer.import', kwargs={
|
return redirect(reverse('plugins:banktransfer:import', kwargs={
|
||||||
'event': self.request.event.slug,
|
'event': self.request.event.slug,
|
||||||
'organizer': self.request.event.organizer.slug,
|
'organizer': self.request.event.organizer.slug,
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ class Paypal(BasePaymentProvider):
|
|||||||
"payment_method": "paypal",
|
"payment_method": "paypal",
|
||||||
},
|
},
|
||||||
"redirect_urls": {
|
"redirect_urls": {
|
||||||
"return_url": request.build_absolute_uri(reverse('plugins:paypal.return')),
|
"return_url": request.build_absolute_uri(reverse('plugins:paypal:return')),
|
||||||
"cancel_url": request.build_absolute_uri(reverse('plugins:paypal.abort')),
|
"cancel_url": request.build_absolute_uri(reverse('plugins:paypal:abort')),
|
||||||
},
|
},
|
||||||
"transactions": [
|
"transactions": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
Our attempt to execute your Payment via PayPal has failed. Please try again or contact us.
|
Our attempt to execute your Payment via PayPal has failed. Please try again or contact us.
|
||||||
{% endblocktrans %}</p>
|
{% endblocktrans %}</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="{% url "plugins:paypal.retry" order=order.code %}" class="btn btn-default">{% trans "Try again" %}</a>
|
<a href="{% url "plugins:paypal:retry" order=order.code %}" class="btn btn-default">{% trans "Try again" %}</a>
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>{% blocktrans trimmed %}
|
<p>{% blocktrans trimmed %}
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ def retry(request, order):
|
|||||||
"payment_method": "paypal",
|
"payment_method": "paypal",
|
||||||
},
|
},
|
||||||
"redirect_urls": {
|
"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
|
'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
|
'order': order.code
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,15 +21,19 @@ if settings.DEBUG:
|
|||||||
url(r'^__debug__/', include(debug_toolbar.urls)),
|
url(r'^__debug__/', include(debug_toolbar.urls)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pluginpatterns = []
|
||||||
for app in apps.get_app_configs():
|
for app in apps.get_app_configs():
|
||||||
if hasattr(app, 'PretixPluginMeta'):
|
if hasattr(app, 'PretixPluginMeta'):
|
||||||
try:
|
try:
|
||||||
urlmod = importlib.import_module(app.name + '.urls')
|
urlmod = importlib.import_module(app.name + '.urls')
|
||||||
urlpatterns.append(
|
pluginpatterns.append(
|
||||||
url(r'', include(urlmod, namespace='plugins'))
|
url(r'', include(urlmod, namespace=app.label))
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
urlpatterns.append(
|
||||||
|
url(r'', include(pluginpatterns, namespace='plugins'))
|
||||||
|
)
|
||||||
|
|
||||||
urlpatterns.append(
|
urlpatterns.append(
|
||||||
url(r'', include(pretix.presale.urls, namespace='presale'))
|
url(r'', include(pretix.presale.urls, namespace='presale'))
|
||||||
|
|||||||
Reference in New Issue
Block a user