* null-check for Checklist.category
* fixed missing deps * cleanup
This commit is contained in:
parent
4ed1a74a16
commit
edf1118f9f
|
|
@ -68,6 +68,7 @@ INSTALLED_APPS = [
|
||||||
'djoser',
|
'djoser',
|
||||||
'debug_toolbar',
|
'debug_toolbar',
|
||||||
'django_filters',
|
'django_filters',
|
||||||
|
'mptt',
|
||||||
|
|
||||||
'store'
|
'store'
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ from django.contrib import admin
|
||||||
from django.contrib.admin import display
|
from django.contrib.admin import display
|
||||||
from mptt.admin import MPTTModelAdmin
|
from mptt.admin import MPTTModelAdmin
|
||||||
|
|
||||||
from .models import Category, Checklist, GlobalSettings, PaymentMethod, Promocode, User, Image, Client
|
|
||||||
|
|
||||||
from .models import Category, Checklist, GlobalSettings, PaymentMethod, Promocode, User, Image
|
from .models import Category, Checklist, GlobalSettings, PaymentMethod, Promocode, User, Image
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -394,9 +394,10 @@ class Checklist(models.Model):
|
||||||
price += self.commission_rub
|
price += self.commission_rub
|
||||||
|
|
||||||
# Add commission of bottom-most category
|
# Add commission of bottom-most category
|
||||||
category = self.category.get_ancestors(ascending=True, include_self=True).first()
|
if self.category:
|
||||||
category_commission = getattr(category, 'commission', 0)
|
category = self.category.get_ancestors(ascending=True, include_self=True).first()
|
||||||
price += category_commission * self.price_rub / 100
|
category_commission = getattr(category, 'commission', 0)
|
||||||
|
price += category_commission * self.price_rub / 100
|
||||||
|
|
||||||
return max(0, math.ceil(price))
|
return max(0, math.ceil(price))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user