Skip to content

Commit

Permalink
Fixed django#1196 -- Admin deletion step no longer assumes related ob…
Browse files Browse the repository at this point in the history
…jects have primary key named 'id'. Thanks, oggie rob

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Jan 15, 2006
1 parent 6e50a2e commit ceb558c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -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/>
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/admin/views/main.py
Expand Up @@ -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.
Expand All @@ -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:
Expand Down

0 comments on commit ceb558c

Please sign in to comment.