Opened 6 years ago

Closed 6 years ago

#30391 closed Bug (worksforme)

.get() ignores .using().

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 DavionKalhen)

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

Change History (2)

comment:1 by DavionKalhen, 6 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 6 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: worksforme
Status: newclosed
Summary: .get ignores .using.get() ignores .using().
Version: 2.1master

Thanks for the report, however it works properly for me (see related tests).

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