This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
The following commit(s) were added to refs/heads/master by this push:
new 9465495 Allow custom Django apps to define a url_prefix
9465495 is described below
commit 94654955dda2e2b38b7e2a2beb1b80404728f559
Author: Marcus Christie <[email protected]>
AuthorDate: Fri Mar 15 11:52:12 2019 -0400
Allow custom Django apps to define a url_prefix
---
django_airavata/urls.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/django_airavata/urls.py b/django_airavata/urls.py
index 2c0bd7c..a1be988 100644
--- a/django_airavata/urls.py
+++ b/django_airavata/urls.py
@@ -38,7 +38,13 @@ urlpatterns = [
# Add custom Django app urls patterns
for custom_django_app in settings.CUSTOM_DJANGO_APPS:
- urlpatterns.append(url(r'^' + custom_django_app.label + '/',
+ # Custom Django apps may define a url_prefix, otherwise label will be used
+ # as url prefix
+ url_prefix = getattr(
+ custom_django_app,
+ 'url_prefix',
+ custom_django_app.label)
+ urlpatterns.append(url(r'^' + url_prefix + '/',
include(custom_django_app.name + ".urls")))
urlpatterns += [