text: import logging
  
  from django.shortcuts import render, get_object_or_404
  
  from .models import Category, Product
  from cart.forms import CartAddProductForm
  
  logger = logging.getLogger('elk-apm')
  
  
  def product_list(request, category_slug=None):
      category = None
      categories = Category.objects.all()
      products = Product.objects.filter(available=True)
      if category_slug:
          category = get_object_or_404(Category, slug=category_slug)
          products = products.filter(category=category)
      else:
          logger.error(
              'Message from view by user with exc_info=True',
              exc_info=True
          )
      return render(request,
                    'shop/product/list.html',
                    {'category': category,
                     'categories': categories,
                     'products': products})
  
  
  def product_detail(request, id, slug):
      # product = get_object_or_404(Product,
      #                             id=id,
      #                             slug=slug,
      #                             available=True)
      product = Product.objects.get(slug=slug)
      cart_product_form = CartAddProductForm()
      return render(request,
                    'shop/product/detail.html',
                    {'product': product,
                     'cart_product_form': cart_product_form})
  