#21216 closed Bug (fixed)

`OneToOneField` reverse accessor cannot be hidden.

Reported by: charettes Owned by: nobody
Component: Database layer (models, ORM) Version: master
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 charettes 22 months ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 22 months ago by charettes

All tests pass on Python 2.7 with SQLite.

comment:2 Changed 22 months ago by timo

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:3 Changed 22 months ago by Simon Charette <charette.s@…>

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

In fa2e1371cda1e72d82b4133ad0b49a18e43ba411:

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

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