prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Documents page broken
  Steps to reproduce:
  1. Go to https://thalia.nu/association/documents/
  
  
  Sentry Issue: [CONCREXIT-4E](https://sentry.io/organizations/thalia/issues/2020405926/?referrer=github_integration)
  
  ```
  FieldError: Cannot resolve keyword 'name_en' into field. Choices are: annualdocument, category, created, event, eventdocument, file, generalmeeting, id, last_updated, members_only, minutes, name
  (5 additional frame(s) were not displayed)
  ...
    File "documents/views.py", line 54, in get_context_data
      "association_documents": AssociationDocument.objects.order_by(
    File "django/db/models/manager.py", line 85, in manager_method
      return getattr(self.get_queryset(), name)(*args, **kwargs)
    File "django/db/models/query.py", line 1134, in order_by
      obj.query.add_ordering(*field_names)
    File "django/db/models/sql/query.py", line 1919, in add_ordering
      self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
    File "django/db/models/sql/query.py", line 1481, in names_to_path
      raise FieldError("Cannot resolve keyword '%s' into field. "
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `website/documents/views.py`
  Content:
  ```
  1 """Views provided by the documents package"""
  2 import os
  3 
  4 from django.conf import settings
  5 from django.core.exceptions import PermissionDenied
  6 from django.http import Http404, HttpResponse
  7 from django.shortcuts import redirect
  8 from django.utils import timezone
  9 from django.utils.text import slugify
  10 from django.utils.translation import get_language
  11 from django.views.generic import TemplateView, DetailView
  12 from django_sendfile import sendfile
  13 
  14 from documents.models import (
  15     AnnualDocument,
  16     AssociationDocument,
  17     GeneralMeeting,
  18     Document,
  19 )
  20 from utils.snippets import datetime_to_lectureyear
  21 
  22 
  23 class DocumentsIndexView(TemplateView):
  24     """
  25     View that renders the documents index page
  26     """
  27 
  28     template_name = "documents/index.html"
  29 
  30     def get_context_data(self, **kwargs) -> dict:
  31         lecture_year = datetime_to_lectureyear(timezone.now())
  32 
  33         years = {x: {} for x in reversed(range(1990, lecture_year + 1))}
  34         for year in years:
  35             years[year] = {
  36                 "documents": {"policy": None, "report": None, "financial": None},
  37                 "general_meetings": [],
  38             }
  39 
  40         for document in AnnualDocument.objects.filter(subcategory="policy"):
  41             years[document.year]["documents"]["policy"] = document
  42         for document in AnnualDocument.objects.filter(subcategory="report"):
  43             years[document.year]["documents"]["report"] = document
  44         for document in AnnualDocument.objects.filter(subcategory="financial"):
  45             years[document.year]["documents"]["financial"] = document
  46 
  47         for obj in GeneralMeeting.objects.all():
  48             meeting_year = datetime_to_lectureyear(obj.datetime)
  49             years[meeting_year]["general_meetings"].append(obj)
  50 
  51         context = super().get_context_data(**kwargs)
  52         context.update(
  53             {
  54                 "association_documents": AssociationDocument.objects.order_by(
  55                     f"name_{get_language()}"
  56                 ).all(),
  57                 "years": list(years.items()),
  58             }
  59         )
  60         return context
  61 
  62 
  63 class DocumentDownloadView(DetailView):
  64     """
  65     View that allows you to download a specific document based on it's and your
  66     permissions settings
  67     """
  68 
  69     model = Document
  70 
  71     def get(self, request, *args, **kwargs) -> HttpResponse:
  72         """
  73         :return: either a 302 redirect to the login page or
  74         a 200 with the document
  75         """
  76         response = super().get(request, *args, **kwargs)
  77         document = response.context_data["document"]
  78 
  79         if document.members_only and not request.user.is_authenticated:
  80             return redirect("{}?next={}".format(settings.LOGIN_URL, request.path))
  81         if document.members_only and not request.member.has_active_membership():
  82             raise PermissionDenied
  83 
  84         lang = request.GET.get("language")
  85         try:
  86             if lang == "en":
  87                 file = document.file_en
  88             else:  # Fall back on language detection
  89                 file = document.file
  90         except ValueError as e:
  91             raise Http404("This document does not exist.") from e
  92 
  93         ext = os.path.splitext(file.path)[1]
  94 
  95         return sendfile(
  96             request,
  97             file.path,
  98             attachment=True,
  99             attachment_filename=slugify(document.name) + ext,
  100         )
  101
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/website/documents/views.py b/website/documents/views.py
  --- a/website/documents/views.py
  +++ b/website/documents/views.py
  @@ -7,7 +7,6 @@
   from django.shortcuts import redirect
   from django.utils import timezone
   from django.utils.text import slugify
  -from django.utils.translation import get_language
   from django.views.generic import TemplateView, DetailView
   from django_sendfile import sendfile
   
  @@ -52,7 +51,7 @@
           context.update(
               {
                   "association_documents": AssociationDocument.objects.order_by(
  -                    f"name_{get_language()}"
  +                    "name"
                   ).all(),
                   "years": list(years.items()),
               }
  @@ -81,12 +80,8 @@
           if document.members_only and not request.member.has_active_membership():
               raise PermissionDenied
   
  -        lang = request.GET.get("language")
           try:
  -            if lang == "en":
  -                file = document.file_en
  -            else:  # Fall back on language detection
  -                file = document.file
  +            file = document.file
           except ValueError as e:
               raise Http404("This document does not exist.") from e
  
verification_info: {"golden_diff": "diff --git a/website/documents/views.py b/website/documents/views.py\n--- a/website/documents/views.py\n+++ b/website/documents/views.py\n@@ -7,7 +7,6 @@\n from django.shortcuts import redirect\n from django.utils import timezone\n from django.utils.text import slugify\n-from django.utils.translation import get_language\n from django.views.generic import TemplateView, DetailView\n from django_sendfile import sendfile\n \n@@ -52,7 +51,7 @@\n         context.update(\n             {\n                 \"association_documents\": AssociationDocument.objects.order_by(\n-                    f\"name_{get_language()}\"\n+                    \"name\"\n                 ).all(),\n                 \"years\": list(years.items()),\n             }\n@@ -81,12 +80,8 @@\n         if document.members_only and not request.member.has_active_membership():\n             raise PermissionDenied\n \n-        lang = request.GET.get(\"language\")\n         try:\n-            if lang == \"en\":\n-                file = document.file_en\n-            else:  # Fall back on language detection\n-                file = document.file\n+            file = document.file\n         except ValueError as e:\n             raise Http404(\"This document does not exist.\") from e\n", "issue": "Documents page broken\nSteps to reproduce:\n1. Go to https://thalia.nu/association/documents/\n\n\nSentry Issue: [CONCREXIT-4E](https://sentry.io/organizations/thalia/issues/2020405926/?referrer=github_integration)\n\n```\nFieldError: Cannot resolve keyword 'name_en' into field. Choices are: annualdocument, category, created, event, eventdocument, file, generalmeeting, id, last_updated, members_only, minutes, name\n(5 additional frame(s) were not displayed)\n...\n  File \"documents/views.py\", line 54, in get_context_data\n    \"association_documents\": AssociationDocument.objects.order_by(\n  File \"django/db/models/manager.py\", line 85, in manager_method\n    return getattr(self.get_queryset(), name)(*args, **kwargs)\n  File \"django/db/models/query.py\", line 1134, in order_by\n    obj.query.add_ordering(*field_names)\n  File \"django/db/models/sql/query.py\", line 1919, in add_ordering\n    self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)\n  File \"django/db/models/sql/query.py\", line 1481, in names_to_path\n    raise FieldError(\"Cannot resolve keyword '%s' into field. \"\n```\n", "before_files": [{"content": "\"\"\"Views provided by the documents package\"\"\"\nimport os\n\nfrom django.conf import settings\nfrom django.core.exceptions import PermissionDenied\nfrom django.http import Http404, HttpResponse\nfrom django.shortcuts import redirect\nfrom django.utils import timezone\nfrom django.utils.text import slugify\nfrom django.utils.translation import get_language\nfrom django.views.generic import TemplateView, DetailView\nfrom django_sendfile import sendfile\n\nfrom documents.models import (\n    AnnualDocument,\n    AssociationDocument,\n    GeneralMeeting,\n    Document,\n)\nfrom utils.snippets import datetime_to_lectureyear\n\n\nclass DocumentsIndexView(TemplateView):\n    \"\"\"\n    View that renders the documents index page\n    \"\"\"\n\n    template_name = \"documents/index.html\"\n\n    def get_context_data(self, **kwargs) -> dict:\n        lecture_year = datetime_to_lectureyear(timezone.now())\n\n        years = {x: {} for x in reversed(range(1990, lecture_year + 1))}\n        for year in years:\n            years[year] = {\n                \"documents\": {\"policy\": None, \"report\": None, \"financial\": None},\n                \"general_meetings\": [],\n            }\n\n        for document in AnnualDocument.objects.filter(subcategory=\"policy\"):\n            years[document.year][\"documents\"][\"policy\"] = document\n        for document in AnnualDocument.objects.filter(subcategory=\"report\"):\n            years[document.year][\"documents\"][\"report\"] = document\n        for document in AnnualDocument.objects.filter(subcategory=\"financial\"):\n            years[document.year][\"documents\"][\"financial\"] = document\n\n        for obj in GeneralMeeting.objects.all():\n            meeting_year = datetime_to_lectureyear(obj.datetime)\n            years[meeting_year][\"general_meetings\"].append(obj)\n\n        context = super().get_context_data(**kwargs)\n        context.update(\n            {\n                \"association_documents\": AssociationDocument.objects.order_by(\n                    f\"name_{get_language()}\"\n                ).all(),\n                \"years\": list(years.items()),\n            }\n        )\n        return context\n\n\nclass DocumentDownloadView(DetailView):\n    \"\"\"\n    View that allows you to download a specific document based on it's and your\n    permissions settings\n    \"\"\"\n\n    model = Document\n\n    def get(self, request, *args, **kwargs) -> HttpResponse:\n        \"\"\"\n        :return: either a 302 redirect to the login page or\n        a 200 with the document\n        \"\"\"\n        response = super().get(request, *args, **kwargs)\n        document = response.context_data[\"document\"]\n\n        if document.members_only and not request.user.is_authenticated:\n            return redirect(\"{}?next={}\".format(settings.LOGIN_URL, request.path))\n        if document.members_only and not request.member.has_active_membership():\n            raise PermissionDenied\n\n        lang = request.GET.get(\"language\")\n        try:\n            if lang == \"en\":\n                file = document.file_en\n            else:  # Fall back on language detection\n                file = document.file\n        except ValueError as e:\n            raise Http404(\"This document does not exist.\") from e\n\n        ext = os.path.splitext(file.path)[1]\n\n        return sendfile(\n            request,\n            file.path,\n            attachment=True,\n            attachment_filename=slugify(document.name) + ext,\n        )\n", "path": "website/documents/views.py"}], "after_files": [{"content": "\"\"\"Views provided by the documents package\"\"\"\nimport os\n\nfrom django.conf import settings\nfrom django.core.exceptions import PermissionDenied\nfrom django.http import Http404, HttpResponse\nfrom django.shortcuts import redirect\nfrom django.utils import timezone\nfrom django.utils.text import slugify\nfrom django.views.generic import TemplateView, DetailView\nfrom django_sendfile import sendfile\n\nfrom documents.models import (\n    AnnualDocument,\n    AssociationDocument,\n    GeneralMeeting,\n    Document,\n)\nfrom utils.snippets import datetime_to_lectureyear\n\n\nclass DocumentsIndexView(TemplateView):\n    \"\"\"\n    View that renders the documents index page\n    \"\"\"\n\n    template_name = \"documents/index.html\"\n\n    def get_context_data(self, **kwargs) -> dict:\n        lecture_year = datetime_to_lectureyear(timezone.now())\n\n        years = {x: {} for x in reversed(range(1990, lecture_year + 1))}\n        for year in years:\n            years[year] = {\n                \"documents\": {\"policy\": None, \"report\": None, \"financial\": None},\n                \"general_meetings\": [],\n            }\n\n        for document in AnnualDocument.objects.filter(subcategory=\"policy\"):\n            years[document.year][\"documents\"][\"policy\"] = document\n        for document in AnnualDocument.objects.filter(subcategory=\"report\"):\n            years[document.year][\"documents\"][\"report\"] = document\n        for document in AnnualDocument.objects.filter(subcategory=\"financial\"):\n            years[document.year][\"documents\"][\"financial\"] = document\n\n        for obj in GeneralMeeting.objects.all():\n            meeting_year = datetime_to_lectureyear(obj.datetime)\n            years[meeting_year][\"general_meetings\"].append(obj)\n\n        context = super().get_context_data(**kwargs)\n        context.update(\n            {\n                \"association_documents\": AssociationDocument.objects.order_by(\n                    \"name\"\n                ).all(),\n                \"years\": list(years.items()),\n            }\n        )\n        return context\n\n\nclass DocumentDownloadView(DetailView):\n    \"\"\"\n    View that allows you to download a specific document based on it's and your\n    permissions settings\n    \"\"\"\n\n    model = Document\n\n    def get(self, request, *args, **kwargs) -> HttpResponse:\n        \"\"\"\n        :return: either a 302 redirect to the login page or\n        a 200 with the document\n        \"\"\"\n        response = super().get(request, *args, **kwargs)\n        document = response.context_data[\"document\"]\n\n        if document.members_only and not request.user.is_authenticated:\n            return redirect(\"{}?next={}\".format(settings.LOGIN_URL, request.path))\n        if document.members_only and not request.member.has_active_membership():\n            raise PermissionDenied\n\n        try:\n            file = document.file\n        except ValueError as e:\n            raise Http404(\"This document does not exist.\") from e\n\n        ext = os.path.splitext(file.path)[1]\n\n        return sendfile(\n            request,\n            file.path,\n            attachment=True,\n            attachment_filename=slugify(document.name) + ext,\n        )\n", "path": "website/documents/views.py"}]}