Opened 17 years ago
Last modified 13 years ago
#5535 closed
.get() should allow myforeignkey_id lookups — at Initial Version
Reported by: | David Cramer | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | rkm, Simon Litchfield | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
To allow easy accessibility as you can with .create on foreignkey_id calls, .get should allow the same.
e.g.
MyModel.objects.create(author_id=1) # Works
MyModel.objects.create(author=Author(id=1)) # Works
MyModel.objects.get(author_id=1) # Doesn't Work
MyModel.objects.get(author=Author(id=1)) # Works
MyModel.objects.get_or_create(author_id=1) # Doesn't Work
Note:
See TracTickets
for help on using tickets.