We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Possibly to prefill Reason textarea on $delete
If you're going to have some human-helped automation that deletes the 20% or so non-en-US documents that aren't actually translated, it would be nice if you don't have to type in the same reason every time. 
<img width="989" alt="Screen Shot 2020-02-26 at 11 56 40 AM" src="https://user-images.githubusercontent.com/26739/75367987-1be85500-588f-11ea-8ba1-f49e0db69cc7.png">

Would be neat if you could control it with something like `?reason=Sample%20reason`

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `kuma/wiki/views/delete.py`
Content:
```
1 from django.db import IntegrityError
2 from django.shortcuts import get_object_or_404, redirect, render
3 from django.utils.translation import ugettext
4 from django.views.decorators.cache import never_cache
5 
6 from kuma.core.decorators import (
7     block_user_agents,
8     ensure_wiki_domain,
9     login_required,
10     permission_required,
11 )
12 from kuma.core.urlresolvers import reverse
13 
14 from ..decorators import check_readonly, process_document_path
15 from ..forms import DocumentDeletionForm
16 from ..models import Document, DocumentDeletionLog, Revision
17 from ..utils import locale_and_slug_from_path
18 
19 
20 @ensure_wiki_domain
21 @never_cache
22 @block_user_agents
23 @login_required
24 @check_readonly
25 def revert_document(request, document_path, revision_id):
26     """
27     Revert document to a specific revision.
28     """
29     document_locale, document_slug, needs_redirect = locale_and_slug_from_path(
30         document_path, request
31     )
32 
33     revision = get_object_or_404(
34         Revision.objects.select_related("document"),
35         pk=revision_id,
36         document__slug=document_slug,
37     )
38 
39     if request.method == "GET":
40         # Render the confirmation page
41         return render(
42             request,
43             "wiki/confirm_revision_revert.html",
44             {"revision": revision, "document": revision.document},
45         )
46     else:
47         comment = request.POST.get("comment")
48         document = revision.document
49         old_revision_pk = revision.pk
50         try:
51             new_revision = document.revert(revision, request.user, comment)
52             # schedule a rendering of the new revision if it really was saved
53             if new_revision.pk != old_revision_pk:
54                 document.schedule_rendering("max-age=0")
55         except IntegrityError:
56             return render(
57                 request,
58                 "wiki/confirm_revision_revert.html",
59                 {
60                     "revision": revision,
61                     "document": revision.document,
62                     "error": ugettext(
63                         "Document already exists. Note: You cannot "
64                         "revert a document that has been moved until you "
65                         "delete its redirect."
66                     ),
67                 },
68             )
69         return redirect("wiki.document_revisions", revision.document.slug)
70 
71 
72 @ensure_wiki_domain
73 @never_cache
74 @block_user_agents
75 @login_required
76 @permission_required("wiki.delete_document")
77 @check_readonly
78 @process_document_path
79 def delete_document(request, document_slug, document_locale):
80     """
81     Delete a Document.
82     """
83     document = get_object_or_404(Document, locale=document_locale, slug=document_slug)
84 
85     # HACK: https://bugzil.la/972545 - Don't delete pages that have children
86     # TODO: https://bugzil.la/972541 - Deleting a page that has subpages
87     prevent = document.children.exists()
88 
89     first_revision = document.revisions.all()[0]
90 
91     if request.method == "POST":
92         form = DocumentDeletionForm(data=request.POST)
93         if form.is_valid():
94             DocumentDeletionLog.objects.create(
95                 locale=document.locale,
96                 slug=document.slug,
97                 user=request.user,
98                 reason=form.cleaned_data["reason"],
99             )
100             document.delete()
101             return redirect(document)
102     else:
103         form = DocumentDeletionForm()
104 
105     context = {
106         "document": document,
107         "form": form,
108         "request": request,
109         "revision": first_revision,
110         "prevent": prevent,
111     }
112     return render(request, "wiki/confirm_document_delete.html", context)
113 
114 
115 @ensure_wiki_domain
116 @never_cache
117 @block_user_agents
118 @login_required
119 @permission_required("wiki.restore_document")
120 @check_readonly
121 @process_document_path
122 def restore_document(request, document_slug, document_locale):
123     """
124     Restore a deleted Document.
125     """
126     document = get_object_or_404(
127         Document.deleted_objects.all(), slug=document_slug, locale=document_locale
128     )
129     document.restore()
130     return redirect(document)
131 
132 
133 @ensure_wiki_domain
134 @never_cache
135 @block_user_agents
136 @login_required
137 @permission_required("wiki.purge_document")
138 @check_readonly
139 @process_document_path
140 def purge_document(request, document_slug, document_locale):
141     """
142     Permanently purge a deleted Document.
143     """
144     document = get_object_or_404(
145         Document.deleted_objects.all(), slug=document_slug, locale=document_locale
146     )
147     deletion_log_entries = DocumentDeletionLog.objects.filter(
148         locale=document_locale, slug=document_slug
149     )
150     if deletion_log_entries.exists():
151         deletion_log = deletion_log_entries.order_by("-pk")[0]
152     else:
153         deletion_log = {}
154 
155     if request.method == "POST" and "confirm" in request.POST:
156         document.purge()
157         return redirect(
158             reverse("wiki.document", args=(document_slug,), locale=document_locale)
159         )
160     else:
161         return render(
162             request,
163             "wiki/confirm_purge.html",
164             {"document": document, "deletion_log": deletion_log},
165         )
166
```
--- 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()

```

diff --git a/kuma/wiki/views/delete.py b/kuma/wiki/views/delete.py
--- a/kuma/wiki/views/delete.py
+++ b/kuma/wiki/views/delete.py
@@ -100,7 +100,8 @@
             document.delete()
             return redirect(document)
     else:
-        form = DocumentDeletionForm()
+
+        form = DocumentDeletionForm(initial={"reason": request.GET.get("reason", "")})
 
     context = {
         "document": document,

{"golden_diff": "diff --git a/kuma/wiki/views/delete.py b/kuma/wiki/views/delete.py\n--- a/kuma/wiki/views/delete.py\n+++ b/kuma/wiki/views/delete.py\n@@ -100,7 +100,8 @@\n             document.delete()\n             return redirect(document)\n     else:\n-        form = DocumentDeletionForm()\n+\n+        form = DocumentDeletionForm(initial={\"reason\": request.GET.get(\"reason\", \"\")})\n \n     context = {\n         \"document\": document,\n", "issue": "Possibly to prefill Reason textarea on $delete\nIf you're going to have some human-helped automation that deletes the 20% or so non-en-US documents that aren't actually translated, it would be nice if you don't have to type in the same reason every time. \r\n<img width=\"989\" alt=\"Screen Shot 2020-02-26 at 11 56 40 AM\" src=\"https://user-images.githubusercontent.com/26739/75367987-1be85500-588f-11ea-8ba1-f49e0db69cc7.png\">\r\n\r\nWould be neat if you could control it with something like `?reason=Sample%20reason`\n", "before_files": [{"content": "from django.db import IntegrityError\nfrom django.shortcuts import get_object_or_404, redirect, render\nfrom django.utils.translation import ugettext\nfrom django.views.decorators.cache import never_cache\n\nfrom kuma.core.decorators import (\n    block_user_agents,\n    ensure_wiki_domain,\n    login_required,\n    permission_required,\n)\nfrom kuma.core.urlresolvers import reverse\n\nfrom ..decorators import check_readonly, process_document_path\nfrom ..forms import DocumentDeletionForm\nfrom ..models import Document, DocumentDeletionLog, Revision\nfrom ..utils import locale_and_slug_from_path\n\n\n@ensure_wiki_domain\n@never_cache\n@block_user_agents\n@login_required\n@check_readonly\ndef revert_document(request, document_path, revision_id):\n    \"\"\"\n    Revert document to a specific revision.\n    \"\"\"\n    document_locale, document_slug, needs_redirect = locale_and_slug_from_path(\n        document_path, request\n    )\n\n    revision = get_object_or_404(\n        Revision.objects.select_related(\"document\"),\n        pk=revision_id,\n        document__slug=document_slug,\n    )\n\n    if request.method == \"GET\":\n        # Render the confirmation page\n        return render(\n            request,\n            \"wiki/confirm_revision_revert.html\",\n            {\"revision\": revision, \"document\": revision.document},\n        )\n    else:\n        comment = request.POST.get(\"comment\")\n        document = revision.document\n        old_revision_pk = revision.pk\n        try:\n            new_revision = document.revert(revision, request.user, comment)\n            # schedule a rendering of the new revision if it really was saved\n            if new_revision.pk != old_revision_pk:\n                document.schedule_rendering(\"max-age=0\")\n        except IntegrityError:\n            return render(\n                request,\n                \"wiki/confirm_revision_revert.html\",\n                {\n                    \"revision\": revision,\n                    \"document\": revision.document,\n                    \"error\": ugettext(\n                        \"Document already exists. Note: You cannot \"\n                        \"revert a document that has been moved until you \"\n                        \"delete its redirect.\"\n                    ),\n                },\n            )\n        return redirect(\"wiki.document_revisions\", revision.document.slug)\n\n\n@ensure_wiki_domain\n@never_cache\n@block_user_agents\n@login_required\n@permission_required(\"wiki.delete_document\")\n@check_readonly\n@process_document_path\ndef delete_document(request, document_slug, document_locale):\n    \"\"\"\n    Delete a Document.\n    \"\"\"\n    document = get_object_or_404(Document, locale=document_locale, slug=document_slug)\n\n    # HACK: https://bugzil.la/972545 - Don't delete pages that have children\n    # TODO: https://bugzil.la/972541 - Deleting a page that has subpages\n    prevent = document.children.exists()\n\n    first_revision = document.revisions.all()[0]\n\n    if request.method == \"POST\":\n        form = DocumentDeletionForm(data=request.POST)\n        if form.is_valid():\n            DocumentDeletionLog.objects.create(\n                locale=document.locale,\n                slug=document.slug,\n                user=request.user,\n                reason=form.cleaned_data[\"reason\"],\n            )\n            document.delete()\n            return redirect(document)\n    else:\n        form = DocumentDeletionForm()\n\n    context = {\n        \"document\": document,\n        \"form\": form,\n        \"request\": request,\n        \"revision\": first_revision,\n        \"prevent\": prevent,\n    }\n    return render(request, \"wiki/confirm_document_delete.html\", context)\n\n\n@ensure_wiki_domain\n@never_cache\n@block_user_agents\n@login_required\n@permission_required(\"wiki.restore_document\")\n@check_readonly\n@process_document_path\ndef restore_document(request, document_slug, document_locale):\n    \"\"\"\n    Restore a deleted Document.\n    \"\"\"\n    document = get_object_or_404(\n        Document.deleted_objects.all(), slug=document_slug, locale=document_locale\n    )\n    document.restore()\n    return redirect(document)\n\n\n@ensure_wiki_domain\n@never_cache\n@block_user_agents\n@login_required\n@permission_required(\"wiki.purge_document\")\n@check_readonly\n@process_document_path\ndef purge_document(request, document_slug, document_locale):\n    \"\"\"\n    Permanently purge a deleted Document.\n    \"\"\"\n    document = get_object_or_404(\n        Document.deleted_objects.all(), slug=document_slug, locale=document_locale\n    )\n    deletion_log_entries = DocumentDeletionLog.objects.filter(\n        locale=document_locale, slug=document_slug\n    )\n    if deletion_log_entries.exists():\n        deletion_log = deletion_log_entries.order_by(\"-pk\")[0]\n    else:\n        deletion_log = {}\n\n    if request.method == \"POST\" and \"confirm\" in request.POST:\n        document.purge()\n        return redirect(\n            reverse(\"wiki.document\", args=(document_slug,), locale=document_locale)\n        )\n    else:\n        return render(\n            request,\n            \"wiki/confirm_purge.html\",\n            {\"document\": document, \"deletion_log\": deletion_log},\n        )\n", "path": "kuma/wiki/views/delete.py"}], "after_files": [{"content": "from django.db import IntegrityError\nfrom django.shortcuts import get_object_or_404, redirect, render\nfrom django.utils.translation import ugettext\nfrom django.views.decorators.cache import never_cache\n\nfrom kuma.core.decorators import (\n    block_user_agents,\n    ensure_wiki_domain,\n    login_required,\n    permission_required,\n)\nfrom kuma.core.urlresolvers import reverse\n\nfrom ..decorators import check_readonly, process_document_path\nfrom ..forms import DocumentDeletionForm\nfrom ..models import Document, DocumentDeletionLog, Revision\nfrom ..utils import locale_and_slug_from_path\n\n\n@ensure_wiki_domain\n@never_cache\n@block_user_agents\n@login_required\n@check_readonly\ndef revert_document(request, document_path, revision_id):\n    \"\"\"\n    Revert document to a specific revision.\n    \"\"\"\n    document_locale, document_slug, needs_redirect = locale_and_slug_from_path(\n        document_path, request\n    )\n\n    revision = get_object_or_404(\n        Revision.objects.select_related(\"document\"),\n        pk=revision_id,\n        document__slug=document_slug,\n    )\n\n    if request.method == \"GET\":\n        # Render the confirmation page\n        return render(\n            request,\n            \"wiki/confirm_revision_revert.html\",\n            {\"revision\": revision, \"document\": revision.document},\n        )\n    else:\n        comment = request.POST.get(\"comment\")\n        document = revision.document\n        old_revision_pk = revision.pk\n        try:\n            new_revision = document.revert(revision, request.user, comment)\n            # schedule a rendering of the new revision if it really was saved\n            if new_revision.pk != old_revision_pk:\n                document.schedule_rendering(\"max-age=0\")\n        except IntegrityError:\n            return render(\n                request,\n                \"wiki/confirm_revision_revert.html\",\n                {\n                    \"revision\": revision,\n                    \"document\": revision.document,\n                    \"error\": ugettext(\n                        \"Document already exists. Note: You cannot \"\n                        \"revert a document that has been moved until you \"\n                        \"delete its redirect.\"\n                    ),\n                },\n            )\n        return redirect(\"wiki.document_revisions\", revision.document.slug)\n\n\n@ensure_wiki_domain\n@never_cache\n@block_user_agents\n@login_required\n@permission_required(\"wiki.delete_document\")\n@check_readonly\n@process_document_path\ndef delete_document(request, document_slug, document_locale):\n    \"\"\"\n    Delete a Document.\n    \"\"\"\n    document = get_object_or_404(Document, locale=document_locale, slug=document_slug)\n\n    # HACK: https://bugzil.la/972545 - Don't delete pages that have children\n    # TODO: https://bugzil.la/972541 - Deleting a page that has subpages\n    prevent = document.children.exists()\n\n    first_revision = document.revisions.all()[0]\n\n    if request.method == \"POST\":\n        form = DocumentDeletionForm(data=request.POST)\n        if form.is_valid():\n            DocumentDeletionLog.objects.create(\n                locale=document.locale,\n                slug=document.slug,\n                user=request.user,\n                reason=form.cleaned_data[\"reason\"],\n            )\n            document.delete()\n            return redirect(document)\n    else:\n\n        form = DocumentDeletionForm(initial={\"reason\": request.GET.get(\"reason\", \"\")})\n\n    context = {\n        \"document\": document,\n        \"form\": form,\n        \"request\": request,\n        \"revision\": first_revision,\n        \"prevent\": prevent,\n    }\n    return render(request, \"wiki/confirm_document_delete.html\", context)\n\n\n@ensure_wiki_domain\n@never_cache\n@block_user_agents\n@login_required\n@permission_required(\"wiki.restore_document\")\n@check_readonly\n@process_document_path\ndef restore_document(request, document_slug, document_locale):\n    \"\"\"\n    Restore a deleted Document.\n    \"\"\"\n    document = get_object_or_404(\n        Document.deleted_objects.all(), slug=document_slug, locale=document_locale\n    )\n    document.restore()\n    return redirect(document)\n\n\n@ensure_wiki_domain\n@never_cache\n@block_user_agents\n@login_required\n@permission_required(\"wiki.purge_document\")\n@check_readonly\n@process_document_path\ndef purge_document(request, document_slug, document_locale):\n    \"\"\"\n    Permanently purge a deleted Document.\n    \"\"\"\n    document = get_object_or_404(\n        Document.deleted_objects.all(), slug=document_slug, locale=document_locale\n    )\n    deletion_log_entries = DocumentDeletionLog.objects.filter(\n        locale=document_locale, slug=document_slug\n    )\n    if deletion_log_entries.exists():\n        deletion_log = deletion_log_entries.order_by(\"-pk\")[0]\n    else:\n        deletion_log = {}\n\n    if request.method == \"POST\" and \"confirm\" in request.POST:\n        document.purge()\n        return redirect(\n            reverse(\"wiki.document\", args=(document_slug,), locale=document_locale)\n        )\n    else:\n        return render(\n            request,\n            \"wiki/confirm_purge.html\",\n            {\"document\": document, \"deletion_log\": deletion_log},\n        )\n", "path": "kuma/wiki/views/delete.py"}]}