Add name for each URL definition.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Sat, 15 Jan 2011 03:58:06 +0530
changeset 407 fe51e9080a17
parent 406 6cd8eda4d8df
child 408 0c12181e2c02
Add name for each URL definition.
pytask/profile/urls.py
pytask/taskapp/urls.py
--- a/pytask/profile/urls.py	Sat Jan 15 03:57:25 2011 +0530
+++ b/pytask/profile/urls.py	Sat Jan 15 03:58:06 2011 +0530
@@ -3,11 +3,16 @@
 
 
 urlpatterns = patterns('pytask.profile.views',
-            url(r'^view/$', 'view_profile'),
-            url(r'^edit/$', 'edit_profile'),
-            url(r'^notf/browse/$', 'browse_notifications'),
-            url(r'^notf/view/nid=(\w+)$', 'view_notification'),
-            url(r'^notf/del/nid=(\w+)$', 'delete_notification'),
-            url(r'^notf/unr/nid=(\w+)$', 'unread_notification'),
-            url(r'^user/view/uid=(\w+)$', 'view_user'),
+  url(r'^view/$', 'view_profile', name='view_profile'),
+  url(r'^edit/$', 'edit_profile', name='edit_profile'),
+  url(r'^notf/browse/$', 'browse_notifications',
+      name='edit_profile'),
+  url(r'^notf/view/(?P<notification_id>\d+)$', 'view_notification',
+      name='view_notification'),
+  url(r'^notf/del/(?P<notification_id>\d+)$', 'delete_notification',
+      name='delete_notification'),
+  url(r'^notf/unr/(?P<notification_id>\d+)$', 'unread_notification',
+      name='unread_notification'),
+  url(r'^user/view/(?P<user_id>\d+)$', 'view_user',
+      name='view_user'),
 )
--- a/pytask/taskapp/urls.py	Sat Jan 15 03:57:25 2011 +0530
+++ b/pytask/taskapp/urls.py	Sat Jan 15 03:58:06 2011 +0530
@@ -3,23 +3,37 @@
 
 
 urlpatterns = patterns('pytask.taskapp.views',
-            url(r'^create/$', 'create_task'),
-            url(r'^edit/tid=(\w+)$', 'edit_task'),
-            url(r'^view/tid=(\w+)$', 'view_task'),
-            url(r'^claim/tid=(\w+)$', 'claim_task'),
-            url(r'^select/tid=(\w+)$', 'select_user'),
-            url(r'^approve/tid=(\w+)$', 'approve_task'),
-            url(r'^approved/tid=(\w+)$', 'approved_task'),
-            url(r'^addreviewer/tid=(\w+)$', 'addreviewer'),
-            url(r'^view/work/tid=(\w+)$', 'view_work'),
-            url(r'^view/report/rid=(\w+)$', 'view_report'),
-            url(r'^submit/report/tid=(\w+)$', 'submit_report'),
-            url(r'^browse/$', 'browse_tasks'),
+  url(r'^create/$', 'create_task', name='create_task'),
+  url(r'^edit/(?P<task_id>\d+)$', 'edit_task', name='edit_task'),
+  url(r'^view/(?P<task_id>\d+)$', 'view_task', name='view_task'),
+  url(r'^claim/(?P<task_id>\d+)$', 'claim_task', name='claim_task'),
+  url(r'^select/(?P<task_id>\d+)$', 'select_user', name='select_user'),
+  url(r'^approve/(?P<task_id>\d+)$', 'approve_task',
+      name='approve_task'),
+  url(r'^approved/(?P<task_id>\d+)$', 'approved_task',
+      name='approved_task'),
+  url(r'^addreviewer/(?P<task_id>\d+)$', 'addreviewer',
+      name='addreviewer'),
+  url(r'^view/work/(?P<task_id>\d+)$', 'view_work', name='view_work'),
+  url(r'^view/report/(?P<report_id>\d+)$', 'view_report',
+      name='view_report'),
+  url(r'^submit/report/(?P<task_id>\d+)$', 'submit_report',
+      name='submit_report'),
+  url(r'^browse/$', 'browse_tasks', name='browse_tasks'),
+)
 
-            url(r'^textbook/create/$', 'create_textbook'),
-            url(r'^textbook/view/tid=(\w+)/$', 'view_textbook'),
-            url(r'^textbook/edit/tid=(\w+)/$', 'edit_textbook'),
-            url(r'^textbook/approve/tid=(\w+)/$', 'approve_textbook'),
-            url(r'^textbook/approved/tid=(\w+)/$', 'approved_textbook'),
-            url(r'^textbook/browse/$', 'browse_textbooks'),
+# URL patterns specific to textbook projects.
+urlpatterns += patterns('pytask.taskapp.views',
+  url(r'^textbook/create/$', 'create_textbook',
+      name='create_textbook'),
+  url(r'^textbook/view/(?P<task_id>\d+)$', 'view_textbook',
+      name='view_textbook'),
+  url(r'^textbook/edit/(?P<task_id>\d+)$', 'edit_textbook',
+      name='edit_textbook'),
+  url(r'^textbook/approve/(?P<task_id>\d+)$', 'approve_textbook',
+      name='approve_textbook'),
+  url(r'^textbook/approved/(?P<task_id>\d+)$', 'approved_textbook',
+      name='approved_textbook'),
+  url(r'^textbook/browse/$', 'browse_textbooks',
+      name='browse_textbooks'),
 )