СС
Size: a a a
СС
M
M
СС
Э
М
View(с переопределением метода dispatch) и DetailView, думал использовать куки для хранения(для незареганных юзеров) и куки + бд для зареганных.AL
AL
AL
М
С
ID
cloudinary_storage.storage.MediaCloudinaryStorage for images ( not raw)
def _remove_extension_for_non_raw_file(self, name):
"""
Implemented as image and video files' Cloudinary public id
shouldn't contain file extensions, otherwise Cloudinary url
would contain doubled extension - Cloudinary adds extension to url
to allow file conversion to arbitrary file, like png to jpg.
"""
М
class ProductDetailView(CartMixin, DetailView):
model = Product
context_object_name = 'product'
template_name = 'product_detail.html'
slug_url_kwarg = 'slug'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['categories'] = self.get_object().category.__class__.objects.all()
context['cart'] = self.cart
return context
С
class ProductDetailView(CartMixin, DetailView):
model = Product
context_object_name = 'product'
template_name = 'product_detail.html'
slug_url_kwarg = 'slug'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['categories'] = self.get_object().category.__class__.objects.all()
context['cart'] = self.cart
return context
М
path('products/<str:slug>/', ProductDetailView.as_view(), name='product_detail')М
С
М
С
С