* Cleanup
This commit is contained in:
parent
dc22af6d4c
commit
edcdc96d8e
|
|
@ -357,7 +357,8 @@ class Checklist(models.Model):
|
||||||
|
|
||||||
if self.promocode_id:
|
if self.promocode_id:
|
||||||
# We assume that working promocode was bound correctly through serializer
|
# We assume that working promocode was bound correctly through serializer
|
||||||
# and intentionally don't check if promocode is active here
|
# and intentionally don't check if promocode is active here.
|
||||||
|
# It's also good for archive orders.
|
||||||
promocode = self.promocode
|
promocode = self.promocode
|
||||||
price -= promocode.discount * self.price_rub / 100
|
price -= promocode.discount * self.price_rub / 100
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,12 +120,12 @@ class ChecklistSerializer(serializers.ModelSerializer):
|
||||||
def update(self, instance, validated_data):
|
def update(self, instance, validated_data):
|
||||||
images = self._collect_images_by_fields(validated_data)
|
images = self._collect_images_by_fields(validated_data)
|
||||||
|
|
||||||
self._create_main_images(instance, images.get('main_images'))
|
|
||||||
self._create_payment_proofs(instance, images.get('payment_proof'))
|
|
||||||
|
|
||||||
# Perform update
|
# Perform update
|
||||||
instance: Checklist = super().update(instance, validated_data)
|
instance: Checklist = super().update(instance, validated_data)
|
||||||
|
|
||||||
|
self._create_main_images(instance, images.get('main_images'))
|
||||||
|
self._create_payment_proofs(instance, images.get('payment_proof'))
|
||||||
|
|
||||||
# Invalidate prefetched images
|
# Invalidate prefetched images
|
||||||
delattr(instance, '_images')
|
delattr(instance, '_images')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user