Add a scope pattern to the URLs.
--- a/project/scipycon/registration/views.py Thu Jul 15 01:47:43 2010 +0530
+++ b/project/scipycon/registration/views.py Fri Jul 16 01:33:33 2010 +0530
@@ -1,10 +1,6 @@
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-
import cStringIO as StringIO
import csv
-# django
from django.conf import settings
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
@@ -196,7 +192,7 @@
return render_to_response(template_name, RequestContext(request, locals()))
-def submit_registration(request,
+def submit_registration(request, scope,
template_name='registration/submit-registration.html'):
'''Allows user to edit registration
'''
--- a/project/urls.py Thu Jul 15 01:47:43 2010 +0530
+++ b/project/urls.py Fri Jul 16 01:33:33 2010 +0530
@@ -8,6 +8,11 @@
admin.autodiscover()
+PROGRAM_PATTERN_CORE = r'[a-z](?:[0-9a-z]|_[0-9a-z])*'
+EVENT_PATTERN_CORE =r'(?:[0-9a-z]|_[0-9a-z])*'
+SCOPE_ARG_PATTERN = r'(?P<scope>%s/%s)' % (
+ PROGRAM_PATTERN_CORE, EVENT_PATTERN_CORE)
+
# Admin
urlpatterns = patterns('',
url(r'^$', direct_to_template, {"template": "home.html"}, name='home'),
@@ -27,11 +32,14 @@
# Registration
urlpatterns += patterns('project.scipycon.registration.views',
- url(r'^registrations/$', 'registrations', name='scipycon_registrations'),
- url(r'^submit-registration/$', 'submit_registration', name='scipycon_submit_registration'),
- url(r'^edit-registration/(?P<id>\d+)/$', 'edit_registration',
- name='scipycon_edit_registration'),
- url(r'^download_csv/', 'download_csv', name="download_csv"),
+ url(r'^%s/registrations/$' % (SCOPE_ARG_PATTERN), 'registrations',
+ name='scipycon_registrations'),
+ url(r'^%s/submit-registration/$' % (SCOPE_ARG_PATTERN),
+ 'submit_registration', name='scipycon_submit_registration'),
+ url(r'^%s/edit-registration/(?P<id>\d+)/$' % (SCOPE_ARG_PATTERN),
+ 'edit_registration', name='scipycon_edit_registration'),
+ url(r'^%s/download_csv/' % (SCOPE_ARG_PATTERN),
+ 'download_csv', name="download_csv"),
)