mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #1196 -- Admin deletion step no longer assumes related objects have primary key named 'id'. Thanks, oggie rob
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6e50a2ef5d
commit
ceb558c277
1
AUTHORS
1
AUTHORS
@ -79,6 +79,7 @@ answer newbie questions, and generally made Django that much better:
|
||||
Robin Munn <http://www.geekforgod.com/>
|
||||
Nebojša Dorđević
|
||||
Sam Newman <http://www.magpiebrain.com/>
|
||||
oggie rob <oz.robharvey@gmail.com>
|
||||
pgross@thoughtworks.com
|
||||
phaedo <http://phaedo.cx/>
|
||||
Luke Plant <http://lukeplant.me.uk/>
|
||||
|
@ -592,7 +592,7 @@ def _get_deleted_objects(deleted_objects, perms_needed, user, obj, opts, current
|
||||
else:
|
||||
# Display a link to the admin page.
|
||||
nh(deleted_objects, current_depth, ['%s: <a href="../../../../%s/%s/%s/">%s</a>' % \
|
||||
(capfirst(related.opts.verbose_name), related.opts.app_label, related.opts.module_name, sub_obj.id, strip_tags(str(sub_obj))), []])
|
||||
(capfirst(related.opts.verbose_name), related.opts.app_label, related.opts.module_name, getattr(sub_obj, related.opts.pk.attname), strip_tags(str(sub_obj))), []])
|
||||
_get_deleted_objects(deleted_objects, perms_needed, user, sub_obj, related.opts, current_depth+2)
|
||||
# If there were related objects, and the user doesn't have
|
||||
# permission to delete them, add the missing perm to perms_needed.
|
||||
@ -618,7 +618,7 @@ def _get_deleted_objects(deleted_objects, perms_needed, user, obj, opts, current
|
||||
nh(deleted_objects, current_depth, [
|
||||
(_('One or more %(fieldname)s in %(name)s:') % {'fieldname': related.field.name, 'name':related.opts.verbose_name}) + \
|
||||
(' <a href="../../../../%s/%s/%s/">%s</a>' % \
|
||||
(related.opts.app_label, related.opts.module_name, sub_obj.id, strip_tags(str(sub_obj)))), []])
|
||||
(related.opts.app_label, related.opts.module_name, getattr(sub_obj, related.opts.pk.attname), strip_tags(str(sub_obj)))), []])
|
||||
# If there were related objects, and the user doesn't have
|
||||
# permission to change them, add the missing perm to perms_needed.
|
||||
if related.opts.admin and has_related_objs:
|
||||
|
Loading…
Reference in New Issue
Block a user