1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

[per-object-permissions] Added comments to change_list and admin_list.py

git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@3628 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Christopher Long 2006-08-20 22:23:42 +00:00
parent 736febadc5
commit 98fc1a220f
3 changed files with 5 additions and 2 deletions

View File

@ -104,9 +104,11 @@ def result_headers(cl):
def items_for_result(cl, result):
first = True
pk = cl.lookup_opts.pk.attname
#If show_all_rows is set to False, then we have to check the permission on the object
if not cl.opts.admin.show_all_rows:
if not cl.user.has_perm(cl.opts.app_label + "." + cl.opts.get_change_permission(), object=result):
return
#Update the count
cl.result_count = cl.result_count +1
for field_name in cl.lookup_opts.admin.list_display:
row_class = ''

View File

@ -645,6 +645,9 @@ class ChangeList(object):
except InvalidPage:
result_list = ()
#This is set to 0 if show_all_rows is false, checking of which rows to be shown
#is done later in the result_list tag at which point it will calculate the correct
#number of rows shown
if self.opts.admin.show_all_rows:
self.result_count = result_count
else:

View File

@ -133,7 +133,6 @@ def delete_row_level_permission(request, app_label, model_name, object_id, ct_id
request.user.message_set.create(message=msg['text'])
request.user.message_set.create(message=msg['text'])
return HttpResponseRedirect(request.META["HTTP_REFERER"])
delete_row_level_permission = staff_member_required(never_cache(delete_row_level_permission))
@ -232,7 +231,6 @@ def change_row_level_permission(request, app_label, model_name, object_id, ct_id
request.user.message_set.create(message=msg['text'])
request.user.message_set.create(message=msg['text'])
return HttpResponseRedirect(request.META["HTTP_REFERER"])
change_row_level_permission = staff_member_required(never_cache(change_row_level_permission))