Fixed display bug in admin when deleting an object that has a OneToOneField

git-svn-id: http://code.djangoproject.com/svn/django/trunk@577 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-08-30 17:03:15 +00:00
parent 02ebeec0dc
commit e1f0accaf6
1 changed files with 2 additions and 2 deletions

View File

@ -775,7 +775,7 @@ def add_stage(request, app_label, module_name, show_delete=False, form_url='', p
new_data.setlist(f.name, new_data[f.name].split(",")) new_data.setlist(f.name, new_data[f.name].split(","))
manipulator.do_html2python(new_data) manipulator.do_html2python(new_data)
new_object = manipulator.save(new_data) new_object = manipulator.save(new_data)
pk_value = getattr(new_object, opts.pk.name) pk_value = getattr(new_object, opts.pk.column)
log.log_action(request.user.id, opts.get_content_type_id(), pk_value, repr(new_object), log.ADDITION) log.log_action(request.user.id, opts.get_content_type_id(), pk_value, repr(new_object), log.ADDITION)
msg = 'The %s "%s" was added successfully.' % (opts.verbose_name, new_object) msg = 'The %s "%s" was added successfully.' % (opts.verbose_name, new_object)
# Here, we distinguish between different save types by checking for # Here, we distinguish between different save types by checking for
@ -1013,7 +1013,7 @@ def _get_deleted_objects(deleted_objects, perms_needed, user, obj, opts, current
# Display a link to the admin page. # Display a link to the admin page.
nh(deleted_objects, current_depth, ['%s: <a href="../../../../%s/%s/%s/">%r</a>' % \ nh(deleted_objects, current_depth, ['%s: <a href="../../../../%s/%s/%s/">%r</a>' % \
(capfirst(rel_opts.verbose_name), rel_opts.app_label, rel_opts.module_name, (capfirst(rel_opts.verbose_name), rel_opts.app_label, rel_opts.module_name,
getattr(sub_obj, rel_opts.pk.name), sub_obj), []]) getattr(sub_obj, rel_opts.pk.column), sub_obj), []])
_get_deleted_objects(deleted_objects, perms_needed, user, sub_obj, rel_opts, current_depth+2) _get_deleted_objects(deleted_objects, perms_needed, user, sub_obj, rel_opts, current_depth+2)
else: else:
has_related_objs = False has_related_objs = False