prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Custom 404 page
  Right now in demo store we display generic 404 page
  https://demo.getsaleor.com/i-do-not-exist/
  
  Could implement something more interesting, with a nice design.
  
  What should be included:
  - [ ] Drawing
  - [ ] Link to the homepage
  - [ ] Search bar (?)
  - [ ] ...
  
  </issue>
  <code>
  [start of saleor/urls.py]
  1 from __future__ import unicode_literals
  2 
  3 from django.conf import settings
  4 from django.conf.urls import url, include
  5 from django.conf.urls.static import static
  6 from django.contrib.sitemaps.views import sitemap
  7 from django.contrib.staticfiles.views import serve
  8 from django.views.i18n import JavaScriptCatalog
  9 from graphene_django.views import GraphQLView
  10 
  11 from .cart.urls import urlpatterns as cart_urls
  12 from .checkout.urls import urlpatterns as checkout_urls
  13 from .core.sitemaps import sitemaps
  14 from .core.urls import urlpatterns as core_urls
  15 from .dashboard.urls import urlpatterns as dashboard_urls
  16 from .data_feeds.urls import urlpatterns as feed_urls
  17 from .order.urls import urlpatterns as order_urls
  18 from .product.urls import urlpatterns as product_urls
  19 from .registration.urls import urlpatterns as registration_urls
  20 from .search.urls import urlpatterns as search_urls
  21 from .userprofile.urls import urlpatterns as userprofile_urls
  22 
  23 urlpatterns = [
  24     url(r'^', include(core_urls)),
  25     url(r'^account/', include(registration_urls)),
  26     url(r'^cart/', include((cart_urls, 'cart'), namespace='cart')),
  27     url(r'^checkout/',
  28         include((checkout_urls, 'checkout'), namespace='checkout')),
  29     url(r'^dashboard/',
  30         include((dashboard_urls, 'dashboard'), namespace='dashboard')),
  31     url(r'^graphql', GraphQLView.as_view(graphiql=settings.DEBUG)),
  32     url(r'^impersonate/', include('impersonate.urls')),
  33     url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
  34     url(r'^order/', include((order_urls, 'order'), namespace='order')),
  35     url(r'^products/',
  36         include((product_urls, 'product'), namespace='product')),
  37     url(r'^profile/',
  38         include((userprofile_urls, 'profile'), namespace='profile')),
  39     url(r'^feeds/',
  40         include((feed_urls, 'data_feeds'), namespace='data_feeds')),
  41     url(r'^search/', include((search_urls, 'search'), namespace='search')),
  42     url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
  43         name='django.contrib.sitemaps.views.sitemap'),
  44     url(r'', include('payments.urls')),
  45     url('', include('social_django.urls', namespace='social')),
  46 ]
  47 
  48 if settings.DEBUG:
  49     # static files (images, css, javascript, etc.)
  50     urlpatterns += [
  51         url(r'^static/(?P<path>.*)$', serve)
  52     ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  53
  [end of saleor/urls.py]
  [start of saleor/core/urls.py]
  1 from __future__ import unicode_literals
  2 
  3 from django.conf.urls import url
  4 
  5 from . import views
  6 
  7 
  8 urlpatterns = [
  9     url(r'^$', views.home, name='home'),
  10     url(r'^style-guide/', views.styleguide, name='styleguide'),
  11     url(r'^impersonate/(?P<uid>\d+)/', views.impersonate,
  12         name='impersonate-start'),
  13 ]
  14
  [end of saleor/core/urls.py]
  [start of saleor/core/views.py]
  1 from __future__ import unicode_literals
  2 
  3 from django.template.response import TemplateResponse
  4 from django.contrib import messages
  5 from django.conf import settings
  6 from django.utils.translation import pgettext_lazy
  7 from impersonate.views import impersonate as orig_impersonate
  8 
  9 from ..dashboard.views import staff_member_required
  10 from ..product.utils import products_with_availability, products_for_homepage
  11 from ..userprofile.models import User
  12 
  13 
  14 def home(request):
  15     products = products_for_homepage()[:8]
  16     products = products_with_availability(
  17         products, discounts=request.discounts, local_currency=request.currency)
  18     return TemplateResponse(
  19         request, 'home.html',
  20         {'products': products, 'parent': None})
  21 
  22 
  23 @staff_member_required
  24 def styleguide(request):
  25     return TemplateResponse(request, 'styleguide.html')
  26 
  27 
  28 def impersonate(request, uid):
  29     response = orig_impersonate(request, uid)
  30     if request.session.modified:
  31         msg = pgettext_lazy(
  32             'Impersonation message',
  33             'You are now logged as {}'.format(User.objects.get(pk=uid)))
  34         messages.success(request, msg)
  35     return response
  36
  [end of saleor/core/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/core/urls.py b/saleor/core/urls.py
  --- a/saleor/core/urls.py
  +++ b/saleor/core/urls.py
  @@ -8,6 +8,7 @@
   urlpatterns = [
       url(r'^$', views.home, name='home'),
       url(r'^style-guide/', views.styleguide, name='styleguide'),
  +    url(r'^404', views.handle_404, name='404'),
       url(r'^impersonate/(?P<uid>\d+)/', views.impersonate,
           name='impersonate-start'),
   ]
  diff --git a/saleor/core/views.py b/saleor/core/views.py
  --- a/saleor/core/views.py
  +++ b/saleor/core/views.py
  @@ -5,6 +5,7 @@
   from django.conf import settings
   from django.utils.translation import pgettext_lazy
   from impersonate.views import impersonate as orig_impersonate
  +from random import randint
   
   from ..dashboard.views import staff_member_required
   from ..product.utils import products_with_availability, products_for_homepage
  @@ -33,3 +34,8 @@
               'You are now logged as {}'.format(User.objects.get(pk=uid)))
           messages.success(request, msg)
       return response
  +
  +
  +def handle_404(request):
  +    ctx = {'variant': randint(0, 2)}
  +    return TemplateResponse(request, '404.html', ctx, status=404)
  diff --git a/saleor/urls.py b/saleor/urls.py
  --- a/saleor/urls.py
  +++ b/saleor/urls.py
  @@ -20,6 +20,9 @@
   from .search.urls import urlpatterns as search_urls
   from .userprofile.urls import urlpatterns as userprofile_urls
   
  +
  +handler404 = 'saleor.core.views.handle_404'
  +
   urlpatterns = [
       url(r'^', include(core_urls)),
       url(r'^account/', include(registration_urls)),
  
verification_info: {"golden_diff": "diff --git a/saleor/core/urls.py b/saleor/core/urls.py\n--- a/saleor/core/urls.py\n+++ b/saleor/core/urls.py\n@@ -8,6 +8,7 @@\n urlpatterns = [\n     url(r'^$', views.home, name='home'),\n     url(r'^style-guide/', views.styleguide, name='styleguide'),\n+    url(r'^404', views.handle_404, name='404'),\n     url(r'^impersonate/(?P<uid>\\d+)/', views.impersonate,\n         name='impersonate-start'),\n ]\ndiff --git a/saleor/core/views.py b/saleor/core/views.py\n--- a/saleor/core/views.py\n+++ b/saleor/core/views.py\n@@ -5,6 +5,7 @@\n from django.conf import settings\n from django.utils.translation import pgettext_lazy\n from impersonate.views import impersonate as orig_impersonate\n+from random import randint\n \n from ..dashboard.views import staff_member_required\n from ..product.utils import products_with_availability, products_for_homepage\n@@ -33,3 +34,8 @@\n             'You are now logged as {}'.format(User.objects.get(pk=uid)))\n         messages.success(request, msg)\n     return response\n+\n+\n+def handle_404(request):\n+    ctx = {'variant': randint(0, 2)}\n+    return TemplateResponse(request, '404.html', ctx, status=404)\ndiff --git a/saleor/urls.py b/saleor/urls.py\n--- a/saleor/urls.py\n+++ b/saleor/urls.py\n@@ -20,6 +20,9 @@\n from .search.urls import urlpatterns as search_urls\n from .userprofile.urls import urlpatterns as userprofile_urls\n \n+\n+handler404 = 'saleor.core.views.handle_404'\n+\n urlpatterns = [\n     url(r'^', include(core_urls)),\n     url(r'^account/', include(registration_urls)),\n", "issue": "Custom 404 page\nRight now in demo store we display generic 404 page\r\nhttps://demo.getsaleor.com/i-do-not-exist/\r\n\r\nCould implement something more interesting, with a nice design.\r\n\r\nWhat should be included:\r\n- [ ] Drawing\r\n- [ ] Link to the homepage\r\n- [ ] Search bar (?)\r\n- [ ] ...\n", "before_files": [{"content": "from __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.conf.urls import url, include\nfrom django.conf.urls.static import static\nfrom django.contrib.sitemaps.views import sitemap\nfrom django.contrib.staticfiles.views import serve\nfrom django.views.i18n import JavaScriptCatalog\nfrom graphene_django.views import GraphQLView\n\nfrom .cart.urls import urlpatterns as cart_urls\nfrom .checkout.urls import urlpatterns as checkout_urls\nfrom .core.sitemaps import sitemaps\nfrom .core.urls import urlpatterns as core_urls\nfrom .dashboard.urls import urlpatterns as dashboard_urls\nfrom .data_feeds.urls import urlpatterns as feed_urls\nfrom .order.urls import urlpatterns as order_urls\nfrom .product.urls import urlpatterns as product_urls\nfrom .registration.urls import urlpatterns as registration_urls\nfrom .search.urls import urlpatterns as search_urls\nfrom .userprofile.urls import urlpatterns as userprofile_urls\n\nurlpatterns = [\n    url(r'^', include(core_urls)),\n    url(r'^account/', include(registration_urls)),\n    url(r'^cart/', include((cart_urls, 'cart'), namespace='cart')),\n    url(r'^checkout/',\n        include((checkout_urls, 'checkout'), namespace='checkout')),\n    url(r'^dashboard/',\n        include((dashboard_urls, 'dashboard'), namespace='dashboard')),\n    url(r'^graphql', GraphQLView.as_view(graphiql=settings.DEBUG)),\n    url(r'^impersonate/', include('impersonate.urls')),\n    url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),\n    url(r'^order/', include((order_urls, 'order'), namespace='order')),\n    url(r'^products/',\n        include((product_urls, 'product'), namespace='product')),\n    url(r'^profile/',\n        include((userprofile_urls, 'profile'), namespace='profile')),\n    url(r'^feeds/',\n        include((feed_urls, 'data_feeds'), namespace='data_feeds')),\n    url(r'^search/', include((search_urls, 'search'), namespace='search')),\n    url(r'^sitemap\\.xml$', sitemap, {'sitemaps': sitemaps},\n        name='django.contrib.sitemaps.views.sitemap'),\n    url(r'', include('payments.urls')),\n    url('', include('social_django.urls', namespace='social')),\n]\n\nif settings.DEBUG:\n    # static files (images, css, javascript, etc.)\n    urlpatterns += [\n        url(r'^static/(?P<path>.*)$', serve)\n    ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n", "path": "saleor/urls.py"}, {"content": "from __future__ import unicode_literals\n\nfrom django.conf.urls import url\n\nfrom . import views\n\n\nurlpatterns = [\n    url(r'^$', views.home, name='home'),\n    url(r'^style-guide/', views.styleguide, name='styleguide'),\n    url(r'^impersonate/(?P<uid>\\d+)/', views.impersonate,\n        name='impersonate-start'),\n]\n", "path": "saleor/core/urls.py"}, {"content": "from __future__ import unicode_literals\n\nfrom django.template.response import TemplateResponse\nfrom django.contrib import messages\nfrom django.conf import settings\nfrom django.utils.translation import pgettext_lazy\nfrom impersonate.views import impersonate as orig_impersonate\n\nfrom ..dashboard.views import staff_member_required\nfrom ..product.utils import products_with_availability, products_for_homepage\nfrom ..userprofile.models import User\n\n\ndef home(request):\n    products = products_for_homepage()[:8]\n    products = products_with_availability(\n        products, discounts=request.discounts, local_currency=request.currency)\n    return TemplateResponse(\n        request, 'home.html',\n        {'products': products, 'parent': None})\n\n\n@staff_member_required\ndef styleguide(request):\n    return TemplateResponse(request, 'styleguide.html')\n\n\ndef impersonate(request, uid):\n    response = orig_impersonate(request, uid)\n    if request.session.modified:\n        msg = pgettext_lazy(\n            'Impersonation message',\n            'You are now logged as {}'.format(User.objects.get(pk=uid)))\n        messages.success(request, msg)\n    return response\n", "path": "saleor/core/views.py"}]}