#9553: Save of ForeignKeys's model doesn't cause update of _id field
---------------------------------------------------+------------------------
Reporter: oldium | Owner: nobody
Status: reopened | Milestone:
Component: Database layer (models, ORM) | Version: 1.0
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by oldium):
* status: closed => reopened
* resolution: invalid =>
Comment:
Actually the problem is not that the inner.save() itself doesn't update
the outer's inner_id field, the problem is that the inner_id field is not
"intelligently" taken from inner's pk during outer.save(). Outer has all
the information to be able to save itself.
To illustrate the problem in detail here is a working code snippet:
{{{
inner.save()
outer.inner = outer.inner
outer.save()
}}}
My opinion is that this is not the "right thing". If you think this is
really wanted behaviour, feel free to close the ticket.
This is from my real-life project (not with Inner and Outer classes, of
course). I can live with the workaround, but this doesn't follow the DRY
principle.
--
Ticket URL: <http://code.djangoproject.com/ticket/9553#comment:2>
Django <http://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
-~----------~----~----~----~------~----~------~--~---