Opened 9 years ago

Closed 6 months ago

#2948 closed New feature (fixed)

Better OneToOneField handling in Admin Interface desired

Reported by: wam-djangobug@… Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Normal Keywords: nfa-someday
Cc: evh293@…, erwin@…, robillard.etienne@…, ekellner@…, someone@…, philipp@…, cmawebsite@…, wonlay@…, brooks.travis@…, stephane@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes


Currently, a one to one relationship renders as a drop down box to select a instance of the related object type. If no object exists of the related type exists, the drop down box is empty with no easy way to create the object. There is no plus mark like there is for ForeignKey.

At the very least, I feel a Plus mark in the user interface associated with the OneToOneField is necessary to make the admin interface usable.

Ideally, since this is a OneToOne relationship, the fields for the related class could be brought directly into the admin interface of the object "extending" the "base" object. I tried specifying edit_inline in my OneToOne field; however, that seemed to want to put my extending class into admin interface of the extended class. If someone creates an object with a OneToOneField, then they are almost certainly want to know and be able to edit the field values of the object that is being extended.

Change History (11)

comment:1 Changed 8 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted
  • Version set to newforms-admin

comment:2 Changed 8 years ago by mtredinnick

Just in case anybody wants to work on this too soon: OneToOne has been slightly refactored on the queryset-refactor branch, so if any of these changes need altering of the OneToOneField code, some coordination will be required (e.g. wait until after the merge).

comment:3 Changed 7 years ago by Karen Tracey <kmtracey@…>

  • Keywords nfa-someday added

comment:4 Changed 7 years ago by brooks.travis@…

  • Cc evh293@… erwin@… robillard.etienne@… ekellner@… someone@… philipp@… cmawebsite@… wonlay@… brooks.travis@… added

From what I can tell, the admin now has a "+" next to the Select for a OneToOneField. The behavior the reporter talks about, with regard to having the parent model's fields in the edit page for the child, is how newforms-admin handles multi-table-inheritance relationships. The only potential issue that might still exist is the inability for the framework, in general, to handle creating a child model instance against an existing parent, a la #7623. That said, I'd say this ticket could probably be closed.

comment:5 Changed 7 years ago by anonymous

  • Cc stephane@… added

comment:6 Changed 5 years ago by lrekucki

  • Severity changed from normal to Normal
  • Type changed from enhancement to New feature

comment:7 Changed 4 years ago by julien

  • UI/UX set

comment:8 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:9 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:10 Changed 4 years ago by aaugustin

  • UI/UX set

Revert accidental batch modification.

comment:11 Changed 6 months ago by timgraham

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

Closing per comment #4.

Note: See TracTickets for help on using tickets.
Back to Top