Opened 19 years ago
Last modified 18 years ago
#805 closed defect
OneToOneField conflicts with ForeignKey — at Initial Version
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a model class that has both a OneToOneField and a ForeignKey to the same other class. Eg.
class Base(meta.Model):
name = CharField()
class Extension(meta.Model):
base = meta.OneToOneField(Base)
parent = meta.ForeignKey(Base)
When using Base instance, when I try to call Base.get_extension() it uses the parent foreign key reference instead of the base OneToOne reference.
Note:
See TracTickets
for help on using tickets.