#17341: Model.save() commits transactions after every parent class save
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.3
(models, ORM) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by akaariai):
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
As #17332 was marked as DDN (fully agreed), I think the cleanup of .save()
included in the patch attached to that ticket should be moved to this
ticket.
There are two things needing cleanup:
- The position of commit_unless_managed, which this ticket addresses
directly
- The logic about handling proxy models. The problem here is that it is
hard to follow what is happening. So hard, that I am pretty sure the last
if condition before the actual save
{{{
if not meta.is_proxy:
do the actual save
}}}
is actually not needed at all. A proxy model can never reach this stage,
see the "if meta.is_proxy: return" above.
I can write a patch incorporating this change. If piggy-bagging the proxy
change is not wanted into this ticket, I can open another ticket. Or just
leave it as is if that is wanted (IMHO bad idea...).
--
Ticket URL: <https://code.djangoproject.com/ticket/17341#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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.