aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/serializers.py
diff options
context:
space:
mode:
authorToni2012-11-05 20:55:03 +0100
committerToni2012-11-05 20:55:03 +0100
commit5d6962825015b3d68826584c50739750d9b3c5c5 (patch)
treed47c629ae944d29ad4c43997ca989e5330782f9f /rest_framework/serializers.py
parent455a8cedcf5aa1f265ae95d4f3bff359d51910c0 (diff)
downloaddjango-rest-framework-5d6962825015b3d68826584c50739750d9b3c5c5.tar.bz2
Update rest_framework/serializers.py
fixed AttributeError in case restore_object is overwritten without explicitly setting self.m2m_data
Diffstat (limited to 'rest_framework/serializers.py')
-rw-r--r--rest_framework/serializers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 28767b16..4f68ada6 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -458,7 +458,7 @@ class ModelSerializer(Serializer):
"""
self.object.save()
- if self.m2m_data and save_m2m:
+ if getattr(self, 'm2m_data', None) and save_m2m:
for accessor_name, object_list in self.m2m_data.items():
setattr(self.object, accessor_name, object_list)
self.m2m_data = {}