text: 
  from django.views import generic
  from .models import Product,ProductType
  import os
  from cart.models import Cart
  from django.shortcuts import render
  from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
  from el_pagination.views import AjaxListView
  
  #a function based view to retrive all the products and render it in the menu.html template
  def product_list(request):
      
      product_list = Product.objects.all()
      producttypes = ProductType.objects.all()
      cart_obj, new_obj = Cart.objects.new_or_get(request)
      #Here in this view, product_list represents a list of products, 
      # which I’m breaking down into blocks of 8 products per page. After paginating it, 
      # I return the numbers object to the template, which is a block of 8 products.
      # page = request.GET.get('page', 1)
      # paginator = Paginator(product_list,4)
      # try:
      #     product_list = paginator.page(page)
      # except PageNotAnInteger:
      #     product_list = paginator.page(1)
      # except EmptyPage:
      #     product_list = paginator.page(paginator.num_pages)
      context = {
          'product_list' : product_list ,
          'producttypes' : producttypes ,
          'cart_obj'     : cart_obj 
      }
      return render(request , 'menu/menu.html' , context)
  
  
  
  #a function based view to retrive a specific detail of specific product filtering using slug
  def product_detail(request , slug):
      product_detail = Product.objects.get(slug=slug)
  
      context = {'product_detail' : product_detail}
  
      return render(request , 'menu/product_detail.html' , context)    
  
  # class menutypelistView(generic.ListView):
  #     model = ProductType
  #     template_name = "base/navbar.html"
   
  #     def get_context_data(self, **kwargs):
  #         context = super().get_context_data(**kwargs)
  #         context['Products'] = Product.objects.all()
  #         return context
  
  #  #class of menu that list the products   
  # class ProductlistView(generic.ListView):
  #     ordering = 'id'
  #     paginate_by = 10
  #     template_name = "menu/menu.html"
  
  
  #     def get_queryset(self):
  #         # the following category will also be added to the context data
  #         self.ProductType = ProductType.objects.get(slug=self.kwargs['slug'])
  #         queryset = Product.objects.filter(ProductTypeId=self.ProductType)
  #          # need to set ordering to get consistent pagination results
  #         queryset = queryset.order_by(self.ordering)
  #         return queryset
  
  #     def get_context_data(self, **kwargs):
  #         context = super().get_context_data(**kwargs)
  #         context['ProductType'] = self.ProductType
  #         return context    
  
  # class productDetailView(generic.DetailView):
  #     model = Product
  #     template_name = 'menu/product_detail.html'       
  
  
  
  
  
  