[0.91-bugfixes][patch] Admin list page for one-to-one objects breaks after viewing detail page
|Reported by:||Owned by:||James Bennett|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
On 0.91-bugfixes, the admin list view for a one-to-one related model will break after viewing an object detail page in certain cases.
How to reproduce:
- View the detail page for a one-to-one object that does not have its "parent" relation set.
- View the list page for the object's model; the list will only show the object viewed from the detail page until the server is restarted.
This happens because in
lookup_kwargs is set to the value of
opts.one_to_one_field.rel.limit_choices_to rather than
.copy()-ing it. Since the function then alters
lookup_kwargs — and thus
limit_choices_to — to add an
__exact argument for the primary key of the model, all code that subsequently checks
limit_choices_to will be affected by the
A patch to correct the issue is attached.
Change History (3)
comment:1 Changed 9 years ago by
|Owner:||changed from Adrian Holovaty to James Bennett|
|Patch needs improvement:||unset|