示例#1
0
 def setUp(self):
     included_urlpatterns = patterns('tests',
         verb_url('GET',     '^test$', 'method_view'),
         verb_url('POST',    '^test$', 'method_view')
     )
     
     self.urlconf = URLConf(patterns('tests',
         verb_url('GET',     '^test$', 'method_view'),
         verb_url('POST',    '^test$', 'method_view'),
         verb_url('PUT',     '^test$', 'method_view'),
         verb_url('DELETE',  '^test$', 'method_view'),
         verb_url('GET',     '^kwarg', 'kwarg_view', {'key': 'get view'}),
         verb_url('POST',    '^kwarg', 'kwarg_view', {'key': 'post view'}),
         url('^include/', include(included_urlpatterns))
     ))
示例#2
0
 def setUp(self):
     included_urlpatterns = patterns('tests',
         url('^included_view$', 'generic_view')
     )
     
     urlpatterns = patterns('tests',
         ('^tuple$', 'generic_view'),
         url('^url$', 'generic_view'),
         url('^non_string_view$', generic_view),
         url('^view_with_name$', 'generic_view', name='view_with_name'),
         url('^kwargs$', 'kwarg_view', kwargs={'key': 'value'}),
         url('^url_reverse$', 'view_one'),
         url('^non_string_view_reverse$', view_two),
         url('^view_with_name_reverse$', 'view_three', name='view_with_name_reverse'),
         url('^include/', include(included_urlpatterns)),
         url('^csrf_exempt_view$', csrf_exempt_view),
     )
     
     urlpatterns += patterns('',
         url('^prefix' , 'generic_view', prefix='tests'),
     )
     
     self.urlconf = URLConf(urlpatterns)