prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  AttributeError: 'QuerySet' object has no attribute 'keys'
  The following appears when you first go to `/` and Pootle tries to redirect you to your language based on your Accept-Lang headers.  Note this will set a cookie so you need to have cookies reset to replicate.
  
  ```python
  AttributeError: 'QuerySet' object has no attribute 'keys'
    File "pootle_app/views/index/index.py", line 94, in dispatch
      else self.languages).values_list('code', flat=True))
    File "pootle/i18n/override.py", line 81, in get_lang_from_http_header
      for lang in supported.keys():
  
  AttributeError: 'QuerySet' object has no attribute 'keys'
  ```
  
  </issue>
  <code>
  [start of pootle/apps/pootle_app/views/index/index.py]
  1 # -*- coding: utf-8 -*-
  2 #
  3 # Copyright (C) Pootle contributors.
  4 #
  5 # This file is a part of the Pootle project. It is distributed under the GPL3
  6 # or later license. See the LICENSE file for a copy of the license and the
  7 # AUTHORS file for copyright and authorship information.
  8 
  9 from django.contrib.auth import REDIRECT_FIELD_NAME
  10 from django.shortcuts import redirect
  11 from django.urls import reverse
  12 from django.utils.functional import cached_property
  13 from django.utils.translation import get_language
  14 from django.views.generic import TemplateView, View
  15 
  16 from pootle.core.decorators import persistent_property
  17 from pootle.core.delegate import revision, scores
  18 from pootle.i18n.override import get_lang_from_http_header
  19 from pootle_language.models import Language
  20 from pootle_project.models import Project, ProjectSet
  21 
  22 
  23 COOKIE_NAME = 'pootle-language'
  24 
  25 
  26 class WelcomeView(TemplateView):
  27     ns = "pootle.web.welcome"
  28     template_name = "welcome.html"
  29 
  30     @property
  31     def revision(self):
  32         return revision.get(self.project_set.directory.__class__)(
  33             self.project_set.directory).get(key="stats")
  34 
  35     @property
  36     def cache_key(self):
  37         return (
  38             "%s.%s.%s"
  39             % (self.request.user.username,
  40                self.revision,
  41                self.request_lang))
  42 
  43     @cached_property
  44     def project_set(self):
  45         user_projects = Project.accessible_by_user(self.request.user)
  46         user_projects = (
  47             Project.objects.for_user(self.request.user)
  48                            .filter(code__in=user_projects))
  49         return ProjectSet(user_projects)
  50 
  51     @property
  52     def request_lang(self):
  53         return get_language()
  54 
  55     @persistent_property
  56     def score_data(self):
  57         return scores.get(ProjectSet)(
  58             self.project_set).display(language=self.request_lang)
  59 
  60     def get_context_data(self, **kwargs):
  61         context = super(WelcomeView, self).get_context_data(**kwargs)
  62         context.update(dict(score_data=self.score_data))
  63         return context
  64 
  65 
  66 class IndexView(View):
  67 
  68     @property
  69     def active_languages(self):
  70         return Language.objects.filter(
  71             translationproject__isnull=False,
  72             translationproject__directory__obsolete=False)
  73 
  74     @property
  75     def all_languages(self):
  76         return self.active_languages
  77 
  78     @property
  79     def languages(self):
  80         return self.active_languages.filter(
  81             translationproject__project__disabled=False)
  82 
  83     def dispatch(self, request, *args, **kwargs):
  84         if not request.user.is_authenticated:
  85             ctx = {
  86                 'next': request.GET.get(REDIRECT_FIELD_NAME, '')}
  87             return WelcomeView.as_view()(request, ctx)
  88         lang = request.COOKIES.get(COOKIE_NAME, None)
  89         if lang is None:
  90             lang = get_lang_from_http_header(
  91                 request,
  92                 (self.all_languages
  93                  if request.user.is_superuser
  94                  else self.languages).values_list('code', flat=True))
  95         if lang is not None and lang not in ('projects', ''):
  96             url = reverse('pootle-language-browse', args=[lang])
  97         else:
  98             url = reverse('pootle-projects-browse')
  99         # Preserve query strings
  100         args = request.GET.urlencode()
  101         qs = '?%s' % args if args else ''
  102         redirect_url = '%s%s' % (url, qs)
  103         return redirect(redirect_url)
  104 
  105 
  106 class AboutView(TemplateView):
  107     template_name = 'about.html'
  108 
  109     def get_context_data(self, **kwargs):
  110         from translate.__version__ import sver as toolkit_version
  111         from pootle import __version__
  112 
  113         return {
  114             'pootle_version': __version__,
  115             'toolkit_version': toolkit_version,
  116         }
  117
  [end of pootle/apps/pootle_app/views/index/index.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/pootle/apps/pootle_app/views/index/index.py b/pootle/apps/pootle_app/views/index/index.py
  --- a/pootle/apps/pootle_app/views/index/index.py
  +++ b/pootle/apps/pootle_app/views/index/index.py
  @@ -89,9 +89,9 @@
           if lang is None:
               lang = get_lang_from_http_header(
                   request,
  -                (self.all_languages
  -                 if request.user.is_superuser
  -                 else self.languages).values_list('code', flat=True))
  +                dict((self.all_languages
  +                      if request.user.is_superuser
  +                      else self.languages).values_list('code', 'fullname')))
           if lang is not None and lang not in ('projects', ''):
               url = reverse('pootle-language-browse', args=[lang])
           else:
  
verification_info: {"golden_diff": "diff --git a/pootle/apps/pootle_app/views/index/index.py b/pootle/apps/pootle_app/views/index/index.py\n--- a/pootle/apps/pootle_app/views/index/index.py\n+++ b/pootle/apps/pootle_app/views/index/index.py\n@@ -89,9 +89,9 @@\n         if lang is None:\n             lang = get_lang_from_http_header(\n                 request,\n-                (self.all_languages\n-                 if request.user.is_superuser\n-                 else self.languages).values_list('code', flat=True))\n+                dict((self.all_languages\n+                      if request.user.is_superuser\n+                      else self.languages).values_list('code', 'fullname')))\n         if lang is not None and lang not in ('projects', ''):\n             url = reverse('pootle-language-browse', args=[lang])\n         else:\n", "issue": "AttributeError: 'QuerySet' object has no attribute 'keys'\nThe following appears when you first go to `/` and Pootle tries to redirect you to your language based on your Accept-Lang headers.  Note this will set a cookie so you need to have cookies reset to replicate.\r\n\r\n```python\r\nAttributeError: 'QuerySet' object has no attribute 'keys'\r\n  File \"pootle_app/views/index/index.py\", line 94, in dispatch\r\n    else self.languages).values_list('code', flat=True))\r\n  File \"pootle/i18n/override.py\", line 81, in get_lang_from_http_header\r\n    for lang in supported.keys():\r\n\r\nAttributeError: 'QuerySet' object has no attribute 'keys'\r\n```\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nfrom django.contrib.auth import REDIRECT_FIELD_NAME\nfrom django.shortcuts import redirect\nfrom django.urls import reverse\nfrom django.utils.functional import cached_property\nfrom django.utils.translation import get_language\nfrom django.views.generic import TemplateView, View\n\nfrom pootle.core.decorators import persistent_property\nfrom pootle.core.delegate import revision, scores\nfrom pootle.i18n.override import get_lang_from_http_header\nfrom pootle_language.models import Language\nfrom pootle_project.models import Project, ProjectSet\n\n\nCOOKIE_NAME = 'pootle-language'\n\n\nclass WelcomeView(TemplateView):\n    ns = \"pootle.web.welcome\"\n    template_name = \"welcome.html\"\n\n    @property\n    def revision(self):\n        return revision.get(self.project_set.directory.__class__)(\n            self.project_set.directory).get(key=\"stats\")\n\n    @property\n    def cache_key(self):\n        return (\n            \"%s.%s.%s\"\n            % (self.request.user.username,\n               self.revision,\n               self.request_lang))\n\n    @cached_property\n    def project_set(self):\n        user_projects = Project.accessible_by_user(self.request.user)\n        user_projects = (\n            Project.objects.for_user(self.request.user)\n                           .filter(code__in=user_projects))\n        return ProjectSet(user_projects)\n\n    @property\n    def request_lang(self):\n        return get_language()\n\n    @persistent_property\n    def score_data(self):\n        return scores.get(ProjectSet)(\n            self.project_set).display(language=self.request_lang)\n\n    def get_context_data(self, **kwargs):\n        context = super(WelcomeView, self).get_context_data(**kwargs)\n        context.update(dict(score_data=self.score_data))\n        return context\n\n\nclass IndexView(View):\n\n    @property\n    def active_languages(self):\n        return Language.objects.filter(\n            translationproject__isnull=False,\n            translationproject__directory__obsolete=False)\n\n    @property\n    def all_languages(self):\n        return self.active_languages\n\n    @property\n    def languages(self):\n        return self.active_languages.filter(\n            translationproject__project__disabled=False)\n\n    def dispatch(self, request, *args, **kwargs):\n        if not request.user.is_authenticated:\n            ctx = {\n                'next': request.GET.get(REDIRECT_FIELD_NAME, '')}\n            return WelcomeView.as_view()(request, ctx)\n        lang = request.COOKIES.get(COOKIE_NAME, None)\n        if lang is None:\n            lang = get_lang_from_http_header(\n                request,\n                (self.all_languages\n                 if request.user.is_superuser\n                 else self.languages).values_list('code', flat=True))\n        if lang is not None and lang not in ('projects', ''):\n            url = reverse('pootle-language-browse', args=[lang])\n        else:\n            url = reverse('pootle-projects-browse')\n        # Preserve query strings\n        args = request.GET.urlencode()\n        qs = '?%s' % args if args else ''\n        redirect_url = '%s%s' % (url, qs)\n        return redirect(redirect_url)\n\n\nclass AboutView(TemplateView):\n    template_name = 'about.html'\n\n    def get_context_data(self, **kwargs):\n        from translate.__version__ import sver as toolkit_version\n        from pootle import __version__\n\n        return {\n            'pootle_version': __version__,\n            'toolkit_version': toolkit_version,\n        }\n", "path": "pootle/apps/pootle_app/views/index/index.py"}]}