prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Project template needs updating for search promotions changes
  The provided view still references the EditorsPick model: https://github.com/torchbox/wagtail/blob/master/wagtail/project_template/search/views.py#L5
  
  Shall we update this to use the new contrib module or remove it completely?
  
  
  </issue>
  <code>
  [start of wagtail/project_template/search/views.py]
  1 from django.shortcuts import render
  2 from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
  3 
  4 from wagtail.wagtailcore.models import Page
  5 from wagtail.wagtailsearch.models import Query, EditorsPick
  6 
  7 
  8 def search(request):
  9     search_query = request.GET.get('query', None)
  10     page = request.GET.get('page', 1)
  11 
  12     # Search
  13     if search_query:
  14         search_results = Page.objects.live().search(search_query)
  15         query = Query.get(search_query)
  16 
  17         # Record hit
  18         query.add_hit()
  19 
  20         # Get search picks
  21         search_picks = query.editors_picks.all()
  22     else:
  23         search_results = Page.objects.none()
  24         search_picks = EditorsPick.objects.none()
  25 
  26     # Pagination
  27     paginator = Paginator(search_results, 10)
  28     try:
  29         search_results = paginator.page(page)
  30     except PageNotAnInteger:
  31         search_results = paginator.page(1)
  32     except EmptyPage:
  33         search_results = paginator.page(paginator.num_pages)
  34 
  35     return render(request, 'search/search.html', {
  36         'search_query': search_query,
  37         'search_results': search_results,
  38         'search_picks': search_picks,
  39     })
  40
  [end of wagtail/project_template/search/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/wagtail/project_template/search/views.py b/wagtail/project_template/search/views.py
  --- a/wagtail/project_template/search/views.py
  +++ b/wagtail/project_template/search/views.py
  @@ -2,7 +2,7 @@
   from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
   
   from wagtail.wagtailcore.models import Page
  -from wagtail.wagtailsearch.models import Query, EditorsPick
  +from wagtail.wagtailsearch.models import Query
   
   
   def search(request):
  @@ -16,12 +16,8 @@
   
           # Record hit
           query.add_hit()
  -
  -        # Get search picks
  -        search_picks = query.editors_picks.all()
       else:
           search_results = Page.objects.none()
  -        search_picks = EditorsPick.objects.none()
   
       # Pagination
       paginator = Paginator(search_results, 10)
  @@ -35,5 +31,4 @@
       return render(request, 'search/search.html', {
           'search_query': search_query,
           'search_results': search_results,
  -        'search_picks': search_picks,
       })
  
verification_info: {"golden_diff": "diff --git a/wagtail/project_template/search/views.py b/wagtail/project_template/search/views.py\n--- a/wagtail/project_template/search/views.py\n+++ b/wagtail/project_template/search/views.py\n@@ -2,7 +2,7 @@\n from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\n \n from wagtail.wagtailcore.models import Page\n-from wagtail.wagtailsearch.models import Query, EditorsPick\n+from wagtail.wagtailsearch.models import Query\n \n \n def search(request):\n@@ -16,12 +16,8 @@\n \n         # Record hit\n         query.add_hit()\n-\n-        # Get search picks\n-        search_picks = query.editors_picks.all()\n     else:\n         search_results = Page.objects.none()\n-        search_picks = EditorsPick.objects.none()\n \n     # Pagination\n     paginator = Paginator(search_results, 10)\n@@ -35,5 +31,4 @@\n     return render(request, 'search/search.html', {\n         'search_query': search_query,\n         'search_results': search_results,\n-        'search_picks': search_picks,\n     })\n", "issue": "Project template needs updating for search promotions changes\nThe provided view still references the EditorsPick model: https://github.com/torchbox/wagtail/blob/master/wagtail/project_template/search/views.py#L5\n\nShall we update this to use the new contrib module or remove it completely?\n\n", "before_files": [{"content": "from django.shortcuts import render\nfrom django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\n\nfrom wagtail.wagtailcore.models import Page\nfrom wagtail.wagtailsearch.models import Query, EditorsPick\n\n\ndef search(request):\n    search_query = request.GET.get('query', None)\n    page = request.GET.get('page', 1)\n\n    # Search\n    if search_query:\n        search_results = Page.objects.live().search(search_query)\n        query = Query.get(search_query)\n\n        # Record hit\n        query.add_hit()\n\n        # Get search picks\n        search_picks = query.editors_picks.all()\n    else:\n        search_results = Page.objects.none()\n        search_picks = EditorsPick.objects.none()\n\n    # Pagination\n    paginator = Paginator(search_results, 10)\n    try:\n        search_results = paginator.page(page)\n    except PageNotAnInteger:\n        search_results = paginator.page(1)\n    except EmptyPage:\n        search_results = paginator.page(paginator.num_pages)\n\n    return render(request, 'search/search.html', {\n        'search_query': search_query,\n        'search_results': search_results,\n        'search_picks': search_picks,\n    })\n", "path": "wagtail/project_template/search/views.py"}]}