plus élégant

This commit is contained in:
François Poulain 2024-06-08 14:09:41 +02:00
parent 065ee38f58
commit 5d1d9ee5ad

View File

@ -15,8 +15,7 @@ def submit_row_tag(parser, token):
@register.simple_tag
def emballe(quantité, fourniture):
quotient = quantité // fourniture.conditionnement
reste = quantité % fourniture.conditionnement
quotient, reste = divmod(quantité, fourniture.conditionnement)
if not reste and quotient == 1:
return f"{quotient} {fourniture.emballage}"
if not reste and quotient > 1: