prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Admin: Main menu won't stay hidden
  Two issues (at least):
  Desktop:  If I close (minimize, desktop) main-menu and click any link, the menu appears again.
  Desktop to mobile: If I minimize the menu on a bigger desktop and then drag window smaller the menu appears again. 
  
  </issue>
  <code>
  [start of shuup/admin/views/menu.py]
  1 # -*- coding: utf-8 -*-
  2 # This file is part of Shuup.
  3 #
  4 # Copyright (c) 2012-2018, Shuup Inc. All rights reserved.
  5 #
  6 # This source code is licensed under the OSL-3.0 license found in the
  7 # LICENSE file in the root directory of this source tree.
  8 from django.http import JsonResponse
  9 from django.views.generic import TemplateView, View
  10 
  11 
  12 class MenuView(TemplateView):
  13     template_name = "shuup/admin/base/_main_menu.jinja"
  14 
  15 
  16 class MenuToggleView(View):
  17     def post(self, request, *args, **kwargs):
  18         request.session["menu_open"] = int(request.POST.get("menu_open", 0))
  19         return JsonResponse({"success": True})
  20
  [end of shuup/admin/views/menu.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/shuup/admin/views/menu.py b/shuup/admin/views/menu.py
  --- a/shuup/admin/views/menu.py
  +++ b/shuup/admin/views/menu.py
  @@ -15,5 +15,5 @@
   
   class MenuToggleView(View):
       def post(self, request, *args, **kwargs):
  -        request.session["menu_open"] = int(request.POST.get("menu_open", 0))
  +        request.session["menu_open"] = not bool(request.session.get("menu_open", True))
           return JsonResponse({"success": True})
  
verification_info: {"golden_diff": "diff --git a/shuup/admin/views/menu.py b/shuup/admin/views/menu.py\n--- a/shuup/admin/views/menu.py\n+++ b/shuup/admin/views/menu.py\n@@ -15,5 +15,5 @@\n \n class MenuToggleView(View):\n     def post(self, request, *args, **kwargs):\n-        request.session[\"menu_open\"] = int(request.POST.get(\"menu_open\", 0))\n+        request.session[\"menu_open\"] = not bool(request.session.get(\"menu_open\", True))\n         return JsonResponse({\"success\": True})\n", "issue": "Admin: Main menu won't stay hidden\nTwo issues (at least):\r\nDesktop:  If I close (minimize, desktop) main-menu and click any link, the menu appears again.\r\nDesktop to mobile: If I minimize the menu on a bigger desktop and then drag window smaller the menu appears again. \n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# This file is part of Shuup.\n#\n# Copyright (c) 2012-2018, Shuup Inc. All rights reserved.\n#\n# This source code is licensed under the OSL-3.0 license found in the\n# LICENSE file in the root directory of this source tree.\nfrom django.http import JsonResponse\nfrom django.views.generic import TemplateView, View\n\n\nclass MenuView(TemplateView):\n    template_name = \"shuup/admin/base/_main_menu.jinja\"\n\n\nclass MenuToggleView(View):\n    def post(self, request, *args, **kwargs):\n        request.session[\"menu_open\"] = int(request.POST.get(\"menu_open\", 0))\n        return JsonResponse({\"success\": True})\n", "path": "shuup/admin/views/menu.py"}]}