#5450: Save_m2m in forms created by form for model should take a instance
argument.
--------------------------------------------------+-------------------------
Reporter: Øyvind Saltvik <[EMAIL PROTECTED]> | Owner:
nobody
Status: new | Component:
Uncategorized
Version: SVN | Resolution:
Keywords: | Stage:
Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
--------------------------------------------------+-------------------------
Comment (by russellm):
I can see the problem you're trying to avoid, but this isn't the right
approach. The m2m data from a form should only ever be used with a very
specific instance - allowing users to specify an arbitrary instance isn't
the way to solve the problem. Plus, the following would still be possible:
{{{
object = form.save(commit=False)
object.foofield = 'something'
form.save_m2m(object)
}}}
which is just as invalid.
The better solution here would be to put in a check at the start of
save_m2m to see if the object has been saved. A simple pk check would
probably suffice, raising an exception if the object isn't saved.
--
Ticket URL: <http://code.djangoproject.com/ticket/5450#comment:2>
Django Code <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
-~----------~----~----~----~------~----~------~--~---