#14373: annotate() will gladly delete your data
--------------------------------------+-------------------------------------
Reporter: patrys | Owner: carljm
Status: new | Milestone: 1.3
Component: ORM aggregation | Version: 1.2
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by carljm):
* owner: => carljm
Comment:
Putting together a patch for this. My initial take is that both fixes
should be made:
1. m2m attributes should be pickier about what can be assigned to them,
and complain rather than silently clear if they get something nonsensical
(need to dig in more to define what exactly nonsensical means, initially
it looks like "iterables only, either of the appropriate model instance or
a valid PK");
2. annotate/aggregate should complain if you tell them to overwrite the
value of an existing field. At least, I don't think this should be
allowed; it's theoretically possible that someone might have a usecase for
it and be depending on it. The other option would be to only disallow it
if it conflicts with an m2m name, since that's the case where it can
immediately destroy data. But overwriting any field's value with the
result of annotate/aggregate could inadvertently destroy data if the
returned instance is later saved, so I'm at least initially in favor of
just making that impossible.
I'm thinking I'll do two separate patches here for the above two issues,
since they aren't dependent on each other. (Perhaps that means this should
be two tickets? I'll leave it as one for now.)
--
Ticket URL: <http://code.djangoproject.com/ticket/14373#comment:3>
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.