move .public to category instead of product

This commit is contained in:
Thomas Steen Rasmussen 2016-05-17 20:56:11 +02:00
parent 17f17d18f7
commit e5d78099cf
2 changed files with 2 additions and 6 deletions

View file

@ -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):

View file

@ -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")