class ObjectDetailMixin:
model = None
template = None
def get(self, request, slug):
obj_model = get_object_or_404(self.model, slug__iexact=slug)
context = {
self.model.__name__.lower(): obj_model,
}
return render(request, self.template, context)
class ProductDetail(ObjectDetailMixin, View):
model = Product
template = 'catalog/categorys/products/products_detail.html'