Add app_name in urls.py

This commit is contained in:
Zhongyuan 2015-12-17 18:10:08 +08:00
parent c29345f5fa
commit 1ddf085612
2 changed files with 5 additions and 3 deletions

View file

@ -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.

View file

@ -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'),
]