Code

Opened 7 years ago

Closed 7 years ago

#3938 closed (fixed)

[0.91-bugfixes][patch] Admin list page for one-to-one objects breaks after viewing detail page

Reported by: Tom Tobin <korpios@…> Owned by: ubernostrum
Component: Core (Other) Version: 0.91
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

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:

  1. View the detail page for a one-to-one object that does not have its "parent" relation set.
  2. 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 django.core.meta.__init__'s manipulator_init function, 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 __exact argument.

A patch to correct the issue is attached.

Attachments (1)

0.91-onetoone-admin-changelist-fix.patch (878 bytes) - added by Tom Tobin <korpios@…> 7 years ago.
fix for Ticket #3938 (admin view bug with one-to-one models)

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by Tom Tobin <korpios@…>

fix for Ticket #3938 (admin view bug with one-to-one models)

comment:1 Changed 7 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from adrian to ubernostrum
  • Patch needs improvement unset

comment:2 Changed 7 years ago by ubernostrum

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [4936].

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.