Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[per-object-permissions] Rewrote urls for row level permission views …

…to take the ajax parameter as a GET instead of a addition to the URL

git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@3534 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 759f426f245fba8f6a9273219103009fdbd7dd0c 1 parent b68a6ae
Christopher Long authored
6 django/contrib/admin/urls.py
View
@@ -29,9 +29,9 @@
('^doc/templates/(?P<template>.*)/$', 'django.contrib.admin.views.doc.template_detail'),
#Row level permissions
- ('^auth/row_level_permission/(?P<ct_id>\d+)/(?P<rlp_id>\d+)/(?P<hash>\w+)/delete/(?P<ajax>.*)$', 'django.contrib.admin.views.row_level_permissions.delete_row_level_permission'),
- ('^auth/row_level_permission/(?P<ct_id>\d+)/(?P<rlp_id>\d+)/(?P<hash>\w+)/change/(?P<ajax>.*)$', 'django.contrib.admin.views.row_level_permissions.change_row_level_permission'),
- ('^auth/row_level_permission/add/(?P<ct_id>\d+)/(?P<obj_id>\d+)/(?P<ajax>.*)$', 'django.contrib.admin.views.row_level_permissions.add_row_level_permission'),
+ ('^auth/row_level_permission/(?P<ct_id>\d+)/(?P<rlp_id>\d+)/(?P<hash>\w+)/delete/$', 'django.contrib.admin.views.row_level_permissions.delete_row_level_permission'),
+ ('^auth/row_level_permission/(?P<ct_id>\d+)/(?P<rlp_id>\d+)/(?P<hash>\w+)/change/$', 'django.contrib.admin.views.row_level_permissions.change_row_level_permission'),
+ ('^auth/row_level_permission/add/(?P<ct_id>\d+)/(?P<obj_id>\d+)/$', 'django.contrib.admin.views.row_level_permissions.add_row_level_permission'),
# Add/change/delete/history
('^([^/]+)/([^/]+)/$', 'django.contrib.admin.views.main.change_list'),
9 django/contrib/admin/views/row_level_permissions.py
View
@@ -7,8 +7,9 @@
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied
import simplejson
-def delete_row_level_permission(request, ct_id, rlp_id, hash, ajax=None):
+def delete_row_level_permission(request, ct_id, rlp_id, hash):
msg = {}
+ ajax = request.GET.has_key("ajax")
if utils.verify_objref_hash(ct_id, rlp_id, hash):
rlp = get_object_or_404(RowLevelPermission, pk=rlp_id)
ct = rlp.model_ct
@@ -28,8 +29,9 @@ def delete_row_level_permission(request, ct_id, rlp_id, hash, ajax=None):
#return HttpResponseRedirect("/edit/%s/%s" % (ct.model, obj.id))
return HttpResponseRedirect("../../../../../../%s/%s/%s" % (obj._meta.app_label, obj._meta.module_name , str(obj.id)))
-def add_row_level_permission(request, ct_id, obj_id, ajax=None):
+def add_row_level_permission(request, ct_id, obj_id):
msg = {}
+ ajax = request.GET.has_key("ajax")
if not request.POST:
msg = { 'result':False, 'text': _("Only POSTs are allowed" )}
if ajax:
@@ -73,8 +75,9 @@ def add_row_level_permission(request, ct_id, obj_id, ajax=None):
msg["results"]=resp_list
return HttpResponse(simplejson.dumps(msg), 'text/javascript')
-def change_row_level_permission(request, ct_id, rlp_id, hash, ajax=None):
+def change_row_level_permission(request, ct_id, rlp_id, hash):
msg = {}
+ ajax = request.GET.has_key("ajax")
if not request.POST:
msg = { 'result':False, 'text': _("Only POSTs are allowed" )}
Please sign in to comment.
Something went wrong with that request. Please try again.