fix for history admin crashing when company is null
This commit is contained in:
@@ -29,7 +29,7 @@ from products.serializers import ProductSerializer, TagFilterSerializer, SearchR
|
||||
from companies.models import Company
|
||||
from stats.models import StatsLog
|
||||
from back_latienda.permissions import IsCreator, IsSiteAdmin, ReadOnly
|
||||
from .utils import extract_search_filters, find_related_products_v6, product_loader, find_related_products_v7
|
||||
from .utils import extract_search_filters, ranked_product_search, product_loader, get_related_products
|
||||
from utils.tag_serializers import TaggitSerializer
|
||||
from utils.tag_filters import ProductTagFilter, ProductOrderFilter
|
||||
|
||||
@@ -59,7 +59,7 @@ class ProductViewSet(viewsets.ModelViewSet):
|
||||
"""
|
||||
# TODO: find the most similar products
|
||||
product = self.get_object()
|
||||
qs = find_related_products_v7(product.description, product.tags.all(), product.attributes.all(), product.category)
|
||||
qs = get_related_products(product.description, product.tags.all(), product.attributes.all(), product.category)
|
||||
serializer = self.serializer_class(qs, many=True)
|
||||
return Response(data=serializer.data)
|
||||
|
||||
@@ -195,7 +195,7 @@ def product_search(request):
|
||||
# split query string into single words
|
||||
chunks = q.split(' ')
|
||||
for chunk in chunks:
|
||||
product_set, min_price, max_price = find_related_products_v6(chunk, shipping_cost, discount, category, tags, price_min, price_max)
|
||||
product_set, min_price, max_price = ranked_product_search(chunk, shipping_cost, discount, category, tags, price_min, price_max)
|
||||
# update price values
|
||||
if product_set:
|
||||
if prices['min'] is None or min_price['price__min'] < prices['min']:
|
||||
|
||||
Reference in New Issue
Block a user