Opened 11 years ago

Closed 11 years ago

#21216 closed Bug (fixed)

`OneToOneField` reverse accessor cannot be hidden.

Reported by: Simon Charette Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

ForeignKey allows to set a related_name ending with a '+' to hide the reverse accessor.

This can be quite useful when you want to reference a third-party app model but want to avoid polluting it when an unnecessary reverse descriptor.

Attaching a patch with tests and a release note. This should help #21212, which aims to document OneToOneField.related_name, to reuse/reference the existing ForeignKey one.

Attachments (1)

0001-Fixed-21216-Allow-OneToOneField-reverse-accessor-to-.patch (5.9 KB ) - added by Simon Charette 11 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Simon Charette, 11 years ago

All tests pass on Python 2.7 with SQLite.

comment:2 by Tim Graham, 11 years ago

Triage Stage: UnreviewedReady for checkin

comment:3 by Simon Charette <charette.s@…>, 11 years ago

Resolution: fixed
Status: newclosed

In fa2e1371cda1e72d82b4133ad0b49a18e43ba411:

Fixed #21216 -- Allow OneToOneField reverse accessor to be hidden.

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