fixed product views to only list active products

This commit is contained in:
Sam
2021-03-05 11:49:21 +00:00
parent 375db09bb3
commit 8518bd09ce
4 changed files with 33 additions and 8 deletions

View File

@@ -42,3 +42,28 @@ class ProductFactory(DjangoModelFactory):
class Meta:
model = Product
class ActiveProductFactory(DjangoModelFactory):
company = SubFactory(CompanyFactory)
sku = FuzzyText(prefix='SKU_', length=10)
name = FuzzyText(prefix='NAME_', length=10)
description = FuzzyText(prefix='DECRIPTION', length=100)
url = FuzzyText(prefix='http://WEB-LINK-', suffix='.test', length=10)
price = FuzzyDecimal(low=1.00)
shipping_cost = FuzzyDecimal(low=1.00)
shipping_terms = FuzzyText(prefix='SHIPPING_TERMS', length=100)
source = FuzzyChoice(choices=[x[1] for x in Product.SOURCES])
sourcing_date = FuzzyDateTime(start_dt=timezone.now())
update_date = FuzzyDateTime(start_dt=timezone.now())
discount = FuzzyDecimal(low=0.00, high=100.00)
stock = FuzzyInteger(low=0)
tags = ['test']
category = FuzzyChoice(choices=FAKE_CATEGORIES) # main tag category
attributes = ['programming/python', 'testing']
identifiers = FuzzyText(prefix='IDENTIFIERS_', length=100)
active = True
class Meta:
model = Product