move .public to category instead of product
This commit is contained in:
parent
17f17d18f7
commit
e5d78099cf
|
@ -106,6 +106,7 @@ class ProductCategory(CreatedUpdatedModel, UUIDModel):
|
|||
|
||||
name = models.CharField(max_length=150)
|
||||
slug = models.SlugField()
|
||||
public = models.BooleanField(default=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -142,11 +143,6 @@ class Product(CreatedUpdatedModel, UUIDModel):
|
|||
)
|
||||
)
|
||||
|
||||
public = models.BooleanField(
|
||||
default=True,
|
||||
help_text='Is this product publicly available in the webshop?'
|
||||
)
|
||||
|
||||
objects = ProductQuerySet.as_manager()
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -170,7 +170,7 @@ class ProductDetailView(LoginRequiredMixin, FormView, DetailView):
|
|||
context_object_name = 'product'
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if not self.get_object().public:
|
||||
if not self.get_object().category.public:
|
||||
### this product is not publicly available
|
||||
raise Http404("Product not found")
|
||||
|
||||
|
|
Loading…
Reference in a new issue