ソースを参照

Fixed calling pre_save in BulkUpdateModelMixin

The pre_save trigger is performed on single objects, however in BulkUpdateModelMixin it was called with a list of objects as argument
Arien Tolner 11 年 前
コミット
5bf8aeb25b
1 ファイル変更1 行追加1 行削除
  1. 1 1
      rest_framework_bulk/mixins.py

+ 1 - 1
rest_framework_bulk/mixins.py

@@ -50,7 +50,7 @@ class BulkUpdateModelMixin(object):
 
         if serializer.is_valid():
             try:
-                self.pre_save(serializer.object)
+                [self.pre_save(obj) for obj in serializer.object]
             except ValidationError as err:
                 # full_clean on model instances may be called in pre_save
                 # so we have to handle eventual errors.