|
@@ -5,6 +5,9 @@ from rest_framework.mixins import CreateModelMixin
|
|
|
from rest_framework.response import Response
|
|
|
|
|
|
|
|
|
+__all__ = ["BulkCreateModelMixin", "BulkUpdateModelMixin", "BulkDestroyModelMixin"]
|
|
|
+
|
|
|
+
|
|
|
class BulkCreateModelMixin(CreateModelMixin):
|
|
|
"""
|
|
|
Either create a single or many model instances in bulk by using the
|
|
@@ -50,7 +53,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.
|