prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Drop cart partitioner from cart view
  Currently the cart is partitioned every time it'd displayed. We really only need to do this when creating an order/payment. We do call it every time the cart is rendered but we then merge all of the partitions back into a single list.
  - [ ] identify places where cart partitioner is called
  - [ ] remove the unnecessary calls from places that don't absolutely need partitioning to work (checkout)
  - [ ] simplify templates so they iterate over the cart instead of walking through a list of partitions that in turn contain items
  - [ ] provide a brief description of the changes for the next release changelog
  
  
  </issue>
  <code>
  [start of saleor/cart/views.py]
  1 from __future__ import unicode_literals
  2 from babeldjango.templatetags.babel import currencyfmt
  3 
  4 from django.contrib import messages
  5 from django.http import JsonResponse
  6 from django.shortcuts import redirect
  7 from django.template.response import TemplateResponse
  8 from django.utils.translation import ugettext as _
  9 
  10 from . import Cart
  11 from .forms import ReplaceCartLineForm
  12 from ..cart.utils import (
  13     contains_unavailable_products, remove_unavailable_products)
  14 
  15 
  16 def index(request, product_id=None):
  17     if product_id is not None:
  18         product_id = int(product_id)
  19     cart = Cart.for_session_cart(request.cart, discounts=request.discounts)
  20     if contains_unavailable_products(cart):
  21         msg = _('Sorry. We don\'t have that many items in stock. '
  22                 'Quantity was set to maximum available for now.')
  23         messages.warning(request, msg)
  24         remove_unavailable_products(cart)
  25     for line in cart:
  26         data = None
  27         if line.product.pk == product_id:
  28             data = request.POST
  29         initial = {'quantity': line.get_quantity()}
  30         form = ReplaceCartLineForm(data, cart=cart, product=line.product,
  31                                    initial=initial)
  32         line.form = form
  33         if form.is_valid():
  34             form.save()
  35             if request.is_ajax():
  36                 response = {
  37                     'productId': line.product.pk,
  38                     'subtotal': currencyfmt(
  39                         line.get_total().gross,
  40                         line.get_total().currency),
  41                     'total': 0}
  42                 if cart:
  43                     response['total'] = currencyfmt(
  44                         cart.get_total().gross, cart.get_total().currency)
  45                 return JsonResponse(response)
  46             return redirect('cart:index')
  47         elif data is not None:
  48             if request.is_ajax():
  49                 response = {'error': form.errors}
  50                 return JsonResponse(response, status=400)
  51     cart_partitioner = cart.partition()
  52     return TemplateResponse(
  53         request, 'cart/index.html', {
  54             'cart': cart_partitioner})
  55
  [end of saleor/cart/views.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/saleor/cart/views.py b/saleor/cart/views.py
  --- a/saleor/cart/views.py
  +++ b/saleor/cart/views.py
  @@ -48,7 +48,6 @@
               if request.is_ajax():
                   response = {'error': form.errors}
                   return JsonResponse(response, status=400)
  -    cart_partitioner = cart.partition()
       return TemplateResponse(
           request, 'cart/index.html', {
  -            'cart': cart_partitioner})
  +            'cart': cart})
  
verification_info: {"golden_diff": "diff --git a/saleor/cart/views.py b/saleor/cart/views.py\n--- a/saleor/cart/views.py\n+++ b/saleor/cart/views.py\n@@ -48,7 +48,6 @@\n             if request.is_ajax():\n                 response = {'error': form.errors}\n                 return JsonResponse(response, status=400)\n-    cart_partitioner = cart.partition()\n     return TemplateResponse(\n         request, 'cart/index.html', {\n-            'cart': cart_partitioner})\n+            'cart': cart})\n", "issue": "Drop cart partitioner from cart view\nCurrently the cart is partitioned every time it'd displayed. We really only need to do this when creating an order/payment. We do call it every time the cart is rendered but we then merge all of the partitions back into a single list.\n- [ ] identify places where cart partitioner is called\n- [ ] remove the unnecessary calls from places that don't absolutely need partitioning to work (checkout)\n- [ ] simplify templates so they iterate over the cart instead of walking through a list of partitions that in turn contain items\n- [ ] provide a brief description of the changes for the next release changelog\n\n", "before_files": [{"content": "from __future__ import unicode_literals\nfrom babeldjango.templatetags.babel import currencyfmt\n\nfrom django.contrib import messages\nfrom django.http import JsonResponse\nfrom django.shortcuts import redirect\nfrom django.template.response import TemplateResponse\nfrom django.utils.translation import ugettext as _\n\nfrom . import Cart\nfrom .forms import ReplaceCartLineForm\nfrom ..cart.utils import (\n    contains_unavailable_products, remove_unavailable_products)\n\n\ndef index(request, product_id=None):\n    if product_id is not None:\n        product_id = int(product_id)\n    cart = Cart.for_session_cart(request.cart, discounts=request.discounts)\n    if contains_unavailable_products(cart):\n        msg = _('Sorry. We don\\'t have that many items in stock. '\n                'Quantity was set to maximum available for now.')\n        messages.warning(request, msg)\n        remove_unavailable_products(cart)\n    for line in cart:\n        data = None\n        if line.product.pk == product_id:\n            data = request.POST\n        initial = {'quantity': line.get_quantity()}\n        form = ReplaceCartLineForm(data, cart=cart, product=line.product,\n                                   initial=initial)\n        line.form = form\n        if form.is_valid():\n            form.save()\n            if request.is_ajax():\n                response = {\n                    'productId': line.product.pk,\n                    'subtotal': currencyfmt(\n                        line.get_total().gross,\n                        line.get_total().currency),\n                    'total': 0}\n                if cart:\n                    response['total'] = currencyfmt(\n                        cart.get_total().gross, cart.get_total().currency)\n                return JsonResponse(response)\n            return redirect('cart:index')\n        elif data is not None:\n            if request.is_ajax():\n                response = {'error': form.errors}\n                return JsonResponse(response, status=400)\n    cart_partitioner = cart.partition()\n    return TemplateResponse(\n        request, 'cart/index.html', {\n            'cart': cart_partitioner})\n", "path": "saleor/cart/views.py"}]}