#2667: calling Add on a ManyToMany field with empty arguments results in bad SQL
-----------------------------------+----------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Type: defect | Status: new
Priority: normal | Milestone:
Component: Core framework | Version:
Severity: normal | Keywords:
-----------------------------------+----------------------------------------
Scenario:
You have generic code which wants to add one or more entries to a
ManyToMany field. the easy way to do this is something like this:
{{{
mapping_values =
Model_one.object.all.filter(foo__bar__baz__in=mylistcriteria)
exising_object.manytomanyfield.add(*mapping_values)
}}}
if mapping fields is empty,e.g [] this will result in an exception because
of bogus SQL generation.
calling add with empty args should probably do nothing rather than
throwing an exception. Of course,this is easy to code around with a
simplecheck.
--
Ticket URL: <http://code.djangoproject.com/ticket/2667>
Django <http://code.djangoproject.org/>
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
-~----------~----~----~----~------~----~------~--~---