Opened 6 years ago
Last modified 6 years ago
#30391 closed Bug
.get ignores .using — at Version 1
Reported by: | DavionKalhen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
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 (last modified by )
When using multiple databases, when accessing the non-default with .using, a subsiquent call to .get will ignore the databases.
Eg:
comment = Comments.objects.using('specialcmts').get(pk=23) #if pk=23 exists in 'default' db, comment will be that value, or it throws an error. comment = Comments.objects.using('specialcmts').filter(pk=23)[0] #Same behaviour as above. #I'm working around this with: comment = None comments = Comments.objects.using('specialcmts').filter(pk=23) for c in comments: comment = c
Note:
See TracTickets
for help on using tickets.