We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `saleor/cart/views.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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})

{"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"}], "after_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    return TemplateResponse(\n        request, 'cart/index.html', {\n            'cart': cart})\n", "path": "saleor/cart/views.py"}]}