mirror of
https://github.com/Crocmagnon/checkout.git
synced 2024-11-22 16:18:03 +01:00
Fix default product display order if no product
This commit is contained in:
parent
5f291178c7
commit
a1e9aad8b2
1 changed files with 4 additions and 1 deletions
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue