Fixes: 1) Corrected products' filtering options on interfaces
This commit is contained in:
parent
9e1430b05c
commit
54d8889ffa
3 changed files with 10 additions and 2 deletions
|
|
@ -155,6 +155,7 @@ class Query(ObjectType):
|
|||
is_active=True,
|
||||
brand__is_active=True,
|
||||
category__is_active=True,
|
||||
stocks__isnull=False,
|
||||
stocks__vendor__is_active=True,
|
||||
)
|
||||
.select_related("brand", "category")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import requests
|
|||
from constance import config
|
||||
from django.contrib.gis.geos import Point
|
||||
from django.db import models
|
||||
from modeltranslation.manager import MultilingualManager
|
||||
|
||||
logger = logging.getLogger("django")
|
||||
|
||||
|
|
@ -64,10 +65,14 @@ class AddressManager(models.Manager):
|
|||
)[0]
|
||||
|
||||
|
||||
class ProductManager(models.Manager):
|
||||
class ProductManager(MultilingualManager):
|
||||
def available(self):
|
||||
return self.filter(
|
||||
is_active=True, brand__is_active=True, category__is_active=True, stocks__vendor__is_active=True
|
||||
is_active=True,
|
||||
brand__is_active=True,
|
||||
category__is_active=True,
|
||||
stocks__isnull=False,
|
||||
stocks__vendor__is_active=True,
|
||||
)
|
||||
|
||||
def available_in_stock(self):
|
||||
|
|
@ -75,6 +80,7 @@ class ProductManager(models.Manager):
|
|||
is_active=True,
|
||||
brand__is_active=True,
|
||||
category__is_active=True,
|
||||
stocks__isnull=False,
|
||||
stocks__vendor__is_active=True,
|
||||
stocks__quantity__gt=0,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -544,6 +544,7 @@ class ProductViewSet(EvibesViewSet):
|
|||
is_active=True,
|
||||
brand__is_active=True,
|
||||
category__is_active=True,
|
||||
stocks__isnull=False,
|
||||
stocks__vendor__is_active=True,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue