# HG changeset patch # User Sverre Rabbelier # Date 1229593924 0 # Node ID da4d499a9598522f87d1dc9b911cc97dfdb2fefb # Parent 48d38f8a50ab154c48714c2722590c4df49fbf89 Allow disabling of the create url with key_fields Patch by: Sverre Rabbelier diff -r 48d38f8a50ab -r da4d499a9598 app/soc/views/helper/params.py --- a/app/soc/views/helper/params.py Thu Dec 18 07:02:48 2008 +0000 +++ b/app/soc/views/helper/params.py Thu Dec 18 09:52:04 2008 +0000 @@ -109,8 +109,6 @@ 'soc.views.models.%(module_name)s.public', 'Show %(name_short)s'), (r'^%(url_name)s/(?Pcreate)$', 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s'), - (r'^%(url_name)s/(?Pcreate)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s'), (r'^%(url_name)s/(?Pcreate)/%(scope)s$', 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s'), (r'^%(url_name)s/(?Pdelete)/%(key_fields)s$', @@ -121,6 +119,11 @@ 'soc.views.models.%(module_name)s.list', 'List %(name_plural)s'), ] + if not params.get('no_create_with_key_fields'): + new_params['django_patterns_defaults'] += [ + (r'^%(url_name)s/(?Pcreate)/%(key_fields)s$', + 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + new_params['public_template'] = 'soc/%(module_name)s/public.html' % params new_params['create_template'] = 'soc/models/edit.html' new_params['edit_template'] = 'soc/models/edit.html'