Пример #1
0
 def perform_update(self, serializer):
     serializer.validated_data['product'] = self.product
     serializer.validated_data['updated_at'] = now()
     serializer.validated_data['src'] = (
         serializer.validated_data.get('src')
         or serializer.validated_data.get('attachment'))
     if 'attachment' in serializer.validated_data:
         del serializer.validated_data['attachment']
     serializer.save()
Пример #2
0
 def perform_update(self, serializer):
     serializer.validated_data['product'] = self.product
     serializer.validated_data['updated_at'] = now()
     serializer.validated_data['src'] = (
         serializer.validated_data.get('src') or
         serializer.validated_data.get('attachment')
     )
     if 'attachment' in serializer.validated_data:
         del serializer.validated_data['attachment']
     serializer.save()
Пример #3
0
 def perform_create(self, serializer):
     serializer.validated_data['created_at'] = now()
     self.perform_update(serializer)
Пример #4
0
 def perform_update(self, serializer):
     serializer.validated_data['updated_at'] = now()
     serializer.save()
Пример #5
0
 def perform_create(self, serializer):
     serializer.validated_data['created_at'] = now()
     serializer.validated_data['position'] = self.get_queryset().count() + 1
     self.perform_update(serializer)
Пример #6
0
 def perform_create(self, serializer):
     serializer.validated_data['created_at'] = now()
     self.perform_update(serializer)
Пример #7
0
 def perform_update(self, serializer):
     serializer.validated_data['updated_at'] = now()
     serializer.save()
Пример #8
0
 def perform_create(self, serializer):
     serializer.validated_data['created_at'] = now()
     serializer.validated_data['position'] = self.get_queryset().count() + 1
     self.perform_update(serializer)