#27614: Storing the DB used in the state before calling `_save_table`
-------------------------------------+-------------------------------------
Reporter: Joseph | Owner: nobody
Kahn |
Type: | Status: new
Uncategorized |
Component: Database | Version: 1.10
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I was trying to figure out why when calling `.using` before `.create` the
`self._state.db` was not available. I happen to want the result of that to
use in the `pk` value, so right now I have to re fetch that information.
As it turns out, the cause can be narrowed down to a single line. However,
I'm not sure if it was ordered that way for a reason but here:
https://github.com/django/django/blob/d2a26c1a90e837777dabdf3d67ceec4d2a70fb86/django/db/models/base.py#L831-L836
Since not every function call gets the `using` param passed to it, but
most get the `instance` like when it wants to get a pk value prior to
saving.
I was wondering if it's possible to move that `self._state.db = using` up.
--
Ticket URL: <https://code.djangoproject.com/ticket/27614>
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/049.f9fa705b04fdf5248337d4c76af3a6ca%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.