summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-01-29 16:12:17 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-01-29 16:12:17 +0000
commit5aea495ac3a000a7b72fa3202e05ff35676e0e4e (patch)
tree24aa5a9e43915a681a8d295c74d3ce4a33179454 /django
parentd28a63cc008c2b62d1e82ecb5ff5a2d92e6a43ec (diff)
Improved newforms.models.save_for_instance() to set many-to-many values via ID instead of instance, to save on a database query, thanks to [4448]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4449 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/newforms/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/newforms/models.py b/django/newforms/models.py
index 9bd6a3ff83..a938b6350e 100644
--- a/django/newforms/models.py
+++ b/django/newforms/models.py
@@ -37,7 +37,7 @@ def save_instance(form, instance, commit=True):
if commit:
instance.save()
for f in opts.many_to_many:
- setattr(instance, f.attname, getattr(instance, f.attname).model.objects.filter(pk__in = clean_data[f.name]))
+ setattr(instance, f.attname, clean_data[f.name])
# GOTCHA: If many-to-many data is given and commit=False, the many-to-many
# data will be lost. This happens because a many-to-many options cannot be
# set on an object until after it's saved. Maybe we should raise an