diff --git a/api/v1/serializers/mixins.py b/api/v1/serializers/mixins.py index a79ff8e5..451b362a 100644 --- a/api/v1/serializers/mixins.py +++ b/api/v1/serializers/mixins.py @@ -145,6 +145,8 @@ class DispatchGalleryMixin(object): ) if 'images' in gallery: for image in gallery['images']: + if not image.get('img'): + continue if isinstance(image['img'], ImageObject): img = image['img'] else: diff --git a/apps/payment/models.py b/apps/payment/models.py index 63664693..a11439c4 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -229,8 +229,8 @@ class Payment(PolymorphicModel): def save(self, *args, **kwargs): if not self.is_paid(): + amount_data = Payment.calc_amount(payment=self) if not self.bonus: - amount_data = Payment.calc_amount(payment=self) self.amount = amount_data.get('amount') if isinstance(self, SchoolPayment): self.weekdays = amount_data.get('weekdays')