plus élégant
This commit is contained in:
parent
065ee38f58
commit
5d1d9ee5ad
@ -15,8 +15,7 @@ def submit_row_tag(parser, token):
|
|||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def emballe(quantité, fourniture):
|
def emballe(quantité, fourniture):
|
||||||
quotient = quantité // fourniture.conditionnement
|
quotient, reste = divmod(quantité, fourniture.conditionnement)
|
||||||
reste = quantité % fourniture.conditionnement
|
|
||||||
if not reste and quotient == 1:
|
if not reste and quotient == 1:
|
||||||
return f"{quotient} {fourniture.emballage}"
|
return f"{quotient} {fourniture.emballage}"
|
||||||
if not reste and quotient > 1:
|
if not reste and quotient > 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user