from django.template.response import TemplateResponse

from ..product.utils import products_with_availability, products_with_details


def home(request):
    products = Product.objects.get_available_products()[:6]
    products = products.prefetch_related('categories', 'images',
                                         'variants__stock')
    return TemplateResponse(
        request, 'home.html',
        {'products': products, 'parent': None})

from django.template.response import TemplateResponse

from ..product.utils import products_with_availability, products_with_details


def home(request):
    products = products_with_details(request.user)[:6]
    products = products_with_availability(
        products, discounts=request.discounts, local_currency=request.currency)
    return TemplateResponse(
        request, 'home.html',
        {'products': products, 'parent': None})

Fix homepage after wrong rebase
Fix homepage after wrong rebase

  from django.template.response import TemplateResponse
  
  from ..product.utils import products_with_availability, products_with_details
  
  
  def home(request):
-     products = Product.objects.get_available_products()[:6]
-     products = products.prefetch_related('categories', 'images',
-                                          'variants__stock')
+     products = products_with_details(request.user)[:6]
+     products = products_with_availability(
+         products, discounts=request.discounts, local_currency=request.currency)
      return TemplateResponse(
          request, 'home.html',
          {'products': products, 'parent': None})
  
Fix homepage after wrong rebase
## Code Before:
from django.template.response import TemplateResponse

from ..product.utils import products_with_availability, products_with_details


def home(request):
    products = Product.objects.get_available_products()[:6]
    products = products.prefetch_related('categories', 'images',
                                         'variants__stock')
    return TemplateResponse(
        request, 'home.html',
        {'products': products, 'parent': None})

## Instruction:
Fix homepage after wrong rebase
## Code After:
from django.template.response import TemplateResponse

from ..product.utils import products_with_availability, products_with_details


def home(request):
    products = products_with_details(request.user)[:6]
    products = products_with_availability(
        products, discounts=request.discounts, local_currency=request.currency)
    return TemplateResponse(
        request, 'home.html',
        {'products': products, 'parent': None})
