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()
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()
def perform_create(self, serializer): serializer.validated_data['created_at'] = now() self.perform_update(serializer)
def perform_update(self, serializer): serializer.validated_data['updated_at'] = now() serializer.save()
def perform_create(self, serializer): serializer.validated_data['created_at'] = now() serializer.validated_data['position'] = self.get_queryset().count() + 1 self.perform_update(serializer)