Opened 12 years ago
Closed 12 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)
Change History (4)
by , 12 years ago
| Attachment: | 0001-Fixed-21216-Allow-OneToOneField-reverse-accessor-to-.patch added |
|---|
comment:1 by , 12 years ago
comment:2 by , 12 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:3 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
All tests pass on Python 2.7 with SQLite.