Opened 18 years ago

Closed 18 years ago

#2955 closed defect (fixed)

[patch] admin's delete_stage() incorrectly displays 'article_set' rather than 'article' when user has insufficient perms

Reported by: mattimustang@… Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using the models in http://www.djangoproject.com/documentation/models/many_to_one/ as an example, when a user deletes a Reporter without sufficient permissions to also delete the reporter's Articles the following message is displayed:

Deleting the reporter 'John Doe' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:

    * article_set

This should really read:

Deleting the reporter 'John Doe' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:

    * article

The following patch fixes this issue:

Index: django/contrib/admin/views/main.py
===================================================================
--- django/contrib/admin/views/main.py  (revision 3917)
+++ django/contrib/admin/views/main.py  (working copy)
@@ -454,7 +454,7 @@
             if related.opts.admin and has_related_objs:
                 p = '%s.%s' % (related.opts.app_label, related.opts.get_delete_permission())
                 if not user.has_perm(p):
-                    perms_needed.add(rel_opts_name)
+                    perms_needed.add(related.opts.verbose_name)
     for related in opts.get_all_related_many_to_many_objects():
         if related.opts in opts_seen:
             continue

regards

matthew

Change History (1)

comment:1 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [3921]) Fixed #2955 -- Fixed incorrect verbose-name display in admin delete_stage message. Thanks for the patch, mattimustang@…

Note: See TracTickets for help on using tickets.
Back to Top