From 1ddf085612a64d06d1ed0c0487dabf6e41903f16 Mon Sep 17 00:00:00 2001 From: Zhongyuan Date: Thu, 17 Dec 2015 18:10:08 +0800 Subject: [PATCH] Add app_name in urls.py --- README.rst | 6 +++--- notifications/urls.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index b2a575c..0556a71 100644 --- a/README.rst +++ b/README.rst @@ -65,11 +65,11 @@ Add the notifications urls to your urlconf:: import notifications - urlpatterns = patterns('', + urlpatterns = [ ... - url('^inbox/notifications/', include(notifications.urls)), + url('^inbox/notifications/', include(notifications.urls, namespace='notifications')), ... - ) + ] The method of installing these urls, importing rather than using ``'notifications.urls'``, is required to ensure that the urls are installed in the ``notifications`` namespace. diff --git a/notifications/urls.py b/notifications/urls.py index cba58e3..d5e9976 100644 --- a/notifications/urls.py +++ b/notifications/urls.py @@ -5,6 +5,7 @@ from django.conf.urls import url from . import views +app_name = 'notifications' urlpatterns = [ url(r'^$', views.AllNotificationsList.as_view(), name='all'), url(r'^unread/$', views.UnreadNotificationsList.as_view(), name='unread'), @@ -15,3 +16,4 @@ urlpatterns = [ url(r'^api/unread_count/$', views.live_unread_notification_count, name='live_unread_notification_count'), url(r'^api/unread_list/$', views.live_unread_notification_list, name='live_unread_notification_list'), ] +