* Cleanup

This commit is contained in:
Phil Zhitnikov 2023-07-17 20:31:51 +04:00
parent dc22af6d4c
commit edcdc96d8e
2 changed files with 5 additions and 4 deletions

View File

@ -357,7 +357,8 @@ class Checklist(models.Model):
if self.promocode_id:
# 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
price -= promocode.discount * self.price_rub / 100

View File

@ -120,12 +120,12 @@ class ChecklistSerializer(serializers.ModelSerializer):
def update(self, instance, 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
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
delattr(instance, '_images')