From f0d8ce9465c585ba17ade9f07f81ead293387b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Wed, 22 Nov 2023 17:43:18 -0300 Subject: [PATCH] =?UTF-8?q?Remove=20erro=20de=20divis=C3=A3o=20por=20zero?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/eventos/admin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sigi/apps/eventos/admin.py b/sigi/apps/eventos/admin.py index bfe3f49..f99e1aa 100644 --- a/sigi/apps/eventos/admin.py +++ b/sigi/apps/eventos/admin.py @@ -1053,7 +1053,11 @@ class EventoAdmin(CartExportReportMixin, admin.ModelAdmin): custo_total=(F("equipe__qtde_diarias") * F("equipe__valor_diaria")) + F("equipe__total_passagens"), custo_participante=Cast( - F("custo_total") / F("total_participantes"), + Case( + When(total_participantes__lte=0, then=None), + default=F("custo_total") / F("total_participantes"), + output_field=my_decimal_field, + ), output_field=my_decimal_field, ), )