Skip to content
Browse files

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

  • Loading branch information...
1 parent 736feba commit 98fc1a220f0e9743cce8a5599dedbff3f5436180 Christopher Long committed
View
2 django/contrib/admin/templatetags/admin_list.py
@@ -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
3 django/contrib/admin/views/main.py
@@ -645,6 +645,9 @@ def get_results(self, request):
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
2 django/contrib/admin/views/row_level_permissions.py
@@ -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))

0 comments on commit 98fc1a2

Please sign in to comment.
Something went wrong with that request. Please try again.