Fix default product display order if no product

This commit is contained in:
Gabriel Augendre 2022-04-26 18:57:30 +02:00
parent 5f291178c7
commit a1e9aad8b2

View file

@ -47,7 +47,10 @@ class PaymentMethod(Model):
def default_product_display_order(): def default_product_display_order():
return Product.objects.last().display_order + 1 last = Product.objects.last()
if last is None:
return 1
return last.display_order + 1
class ProductQuerySet(models.QuerySet): class ProductQuerySet(models.QuerySet):