[Django] #11296: Delete confirmation page in Admin displays circular references.

1 view
Skip to first unread message

Django

unread,
Jun 10, 2009, 6:20:49 PM6/10/09
to djang...@holovaty.com, django-...@googlegroups.com
#11296: Delete confirmation page in Admin displays circular references.
----------------------------------+-----------------------------------------
Reporter: benreynwar | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.0
Keywords: | Stage: Unreviewed
Has_patch: 1 |
----------------------------------+-----------------------------------------
A very minor bug, but also I think easy to fix. The current delete
confirmation page in the admin application will display the same object
multiple times if there are circular references. e.g. If we have two
objects that reference each other with foreign keys then the list of
dependent objects to be deleted that is displayed would be-[[BR]]

{{{
-object1
-object2
-object1
-object2
etc.
}}}

I think it would be better if it only displayed the first object1 and
object2.
I have attached a small patch that appears to do this.

--
Ticket URL: <http://code.djangoproject.com/ticket/11296>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 10, 2009, 6:29:42 PM6/10/09
to djang...@holovaty.com, django-...@googlegroups.com
#11296: Delete confirmation page in Admin displays circular references.
-------------------------------------------+--------------------------------
Reporter: benreynwar | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.0
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
-------------------------------------------+--------------------------------
Changes (by Alex):

* needs_better_patch: => 1
* needs_tests: => 0
* needs_docs: => 0

--
Ticket URL: <http://code.djangoproject.com/ticket/11296#comment:1>

Django

unread,
Nov 1, 2009, 12:36:14 PM11/1/09
to djang...@holovaty.com, django-...@googlegroups.com
#11296: Delete confirmation page in Admin displays circular references.
-------------------------------------------+--------------------------------
Reporter: benreynwar | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.0
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by bendavis78):

* needs_better_patch: 1 => 0

Comment:

The original object being deleted should also not be recursed into. This
can be easily fixed by adding it to the seen_opts variable at the
beginning of the function (as seen in updated patch):

{{{
@@ -85,7 +85,7 @@
nh = _nest_help # Bind to local variable for performance
if current_depth > 16:
return # Avoid recursing too deep.
- opts_seen = []
+ opts_seen += [obj._meta]
for related in opts.get_all_related_objects():
has_admin = related.model in admin_site._registry
if related.opts in opts_seen:

}}}

--
Ticket URL: <http://code.djangoproject.com/ticket/11296#comment:3>

Django

unread,
Nov 1, 2009, 1:00:26 PM11/1/09
to djang...@holovaty.com, django-...@googlegroups.com
#11296: Delete confirmation page in Admin displays circular references.
-------------------------------------------+--------------------------------
Reporter: benreynwar | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.0
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
-------------------------------------------+--------------------------------
Changes (by Alex):

* needs_better_patch: 0 => 1

Comment:

This patch still has a mutable default value, which means that the deleted
objects will essentially be cached across calls.

--
Ticket URL: <http://code.djangoproject.com/ticket/11296#comment:4>

Django

unread,
Jan 10, 2010, 6:20:37 PM1/10/10
to djang...@holovaty.com, django-...@googlegroups.com
#11296: Delete confirmation page in Admin displays circular references.
-------------------------------------------+--------------------------------
Reporter: benreynwar | Owner: carljm
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.0
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
-------------------------------------------+--------------------------------
Changes (by carljm):

* owner: nobody => carljm

--
Ticket URL: <http://code.djangoproject.com/ticket/11296#comment:5>

Django

unread,
Jan 10, 2010, 7:28:31 PM1/10/10
to djang...@holovaty.com, django-...@googlegroups.com
#11296: Delete confirmation page in Admin displays circular references.
-------------------------------------------+--------------------------------
Reporter: benreynwar | Owner: carljm
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.0
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
-------------------------------------------+--------------------------------
Comment (by carljm):

I'm exploring a possible solution for this as part of the fix for #6191.

--
Ticket URL: <http://code.djangoproject.com/ticket/11296#comment:6>

Django

unread,
Jan 14, 2010, 8:10:27 AM1/14/10
to djang...@holovaty.com, django-...@googlegroups.com
#11296: Delete confirmation page in Admin displays circular references.
-------------------------------------------+--------------------------------
Reporter: benreynwar | Owner: carljm
Status: new | Milestone: 1.2
Component: django.contrib.admin | Version: 1.0
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by carljm):

* needs_better_patch: 1 => 0
* milestone: => 1.2

Comment:

This is fixed in the latest patch on #6191.

--
Ticket URL: <http://code.djangoproject.com/ticket/11296#comment:7>
Reply all
Reply to author
Forward
0 new messages