prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Users should see which avatar is theirs
  
  
  </issue>
  <code>
  [start of players/views.py]
  1 import logging
  2 
  3 from django.http import JsonResponse
  4 from django.contrib.auth.decorators import login_required
  5 from django.http import HttpResponse
  6 from django.views.generic import TemplateView
  7 
  8 import os
  9 
  10 from models import Player
  11 from . import app_settings
  12 
  13 
  14 def _post_code_success_response(message):
  15     return create_response("SUCCESS", message)
  16 
  17 
  18 def create_response(status, message):
  19     response = {
  20         "status": status,
  21         "message": message
  22     }
  23     return JsonResponse(response)
  24 
  25 
  26 @login_required
  27 def code(request):
  28     try:
  29         player = request.user.player
  30     except Player.DoesNotExist:
  31         initial_code_file_name = os.path.join(
  32             os.path.abspath(os.path.dirname(__file__)),
  33             'avatar_examples/dumb_avatar.py',
  34         )
  35         with open(initial_code_file_name) as initial_code_file:
  36             initial_code = initial_code_file.read()
  37         player = Player.objects.create(user=request.user, code=initial_code)
  38     if request.method == 'POST':
  39         player.code = request.POST['code']
  40         player.save()
  41 
  42         return _post_code_success_response("Your code was saved!")
  43     else:
  44         return HttpResponse(player.code)
  45 
  46 
  47 def games(request):
  48     response = {
  49         'main': {
  50             'parameters': [],
  51             'users': [
  52                 {
  53                     'id': player.user.pk,
  54                     'code': player.code,
  55                 } for player in Player.objects.all()
  56             ]
  57         }
  58     }
  59     return JsonResponse(response)
  60 
  61 
  62 class WatchView(TemplateView):
  63     template_name = 'players/watch.html'
  64 
  65     def get_context_data(self, **kwargs):
  66         context = super(WatchView, self).get_context_data(**kwargs)
  67         context['game_url_base'], context['game_url_path'] = app_settings.GAME_SERVER_LOCATION_FUNCTION('main')
  68         return context
  69
  [end of players/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/players/views.py b/players/views.py
  --- a/players/views.py
  +++ b/players/views.py
  @@ -65,4 +65,5 @@
       def get_context_data(self, **kwargs):
           context = super(WatchView, self).get_context_data(**kwargs)
           context['game_url_base'], context['game_url_path'] = app_settings.GAME_SERVER_LOCATION_FUNCTION('main')
  +        context['current_user_player_key'] = self.request.user.pk
           return context
  
verification_info: {"golden_diff": "diff --git a/players/views.py b/players/views.py\n--- a/players/views.py\n+++ b/players/views.py\n@@ -65,4 +65,5 @@\n     def get_context_data(self, **kwargs):\n         context = super(WatchView, self).get_context_data(**kwargs)\n         context['game_url_base'], context['game_url_path'] = app_settings.GAME_SERVER_LOCATION_FUNCTION('main')\n+        context['current_user_player_key'] = self.request.user.pk\n         return context\n", "issue": "Users should see which avatar is theirs\n\n", "before_files": [{"content": "import logging\n\nfrom django.http import JsonResponse\nfrom django.contrib.auth.decorators import login_required\nfrom django.http import HttpResponse\nfrom django.views.generic import TemplateView\n\nimport os\n\nfrom models import Player\nfrom . import app_settings\n\n\ndef _post_code_success_response(message):\n    return create_response(\"SUCCESS\", message)\n\n\ndef create_response(status, message):\n    response = {\n        \"status\": status,\n        \"message\": message\n    }\n    return JsonResponse(response)\n\n\n@login_required\ndef code(request):\n    try:\n        player = request.user.player\n    except Player.DoesNotExist:\n        initial_code_file_name = os.path.join(\n            os.path.abspath(os.path.dirname(__file__)),\n            'avatar_examples/dumb_avatar.py',\n        )\n        with open(initial_code_file_name) as initial_code_file:\n            initial_code = initial_code_file.read()\n        player = Player.objects.create(user=request.user, code=initial_code)\n    if request.method == 'POST':\n        player.code = request.POST['code']\n        player.save()\n\n        return _post_code_success_response(\"Your code was saved!\")\n    else:\n        return HttpResponse(player.code)\n\n\ndef games(request):\n    response = {\n        'main': {\n            'parameters': [],\n            'users': [\n                {\n                    'id': player.user.pk,\n                    'code': player.code,\n                } for player in Player.objects.all()\n            ]\n        }\n    }\n    return JsonResponse(response)\n\n\nclass WatchView(TemplateView):\n    template_name = 'players/watch.html'\n\n    def get_context_data(self, **kwargs):\n        context = super(WatchView, self).get_context_data(**kwargs)\n        context['game_url_base'], context['game_url_path'] = app_settings.GAME_SERVER_LOCATION_FUNCTION('main')\n        return context\n", "path": "players/views.py"}]}