#30391: .get ignores .using
-------------------------------+--------------------------------------
Reporter: DavionKalhen | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by DavionKalhen:
Old description:
> 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.
> }}}
New description:
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
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30391#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.779f3e701e524fedec9ba862186d0ce4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.