From 9baa23b5a154113b0f0da754115dd9583c46a5bb Mon Sep 17 00:00:00 2001 From: gzbender Date: Tue, 12 Feb 2019 12:40:49 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20=D1=81?= =?UTF-8?q?=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA?= =?UTF-8?q?=D1=83=D1=80=D1=81=D0=B0=20(https://sentry.lil.school/lil/backe?= =?UTF-8?q?nd/issues/76/)=20=D0=B8=20=D0=BE=D0=BF=D0=BB=D0=B0=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/serializers/mixins.py | 2 ++ apps/payment/models.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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')