We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Fix delete permissions for course registration


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `make_queue/views/admin/course.py`
Content:
```
1 import io
2 
3 import xlsxwriter
4 from django.contrib.auth.mixins import PermissionRequiredMixin
5 from django.db.models import Q
6 from django.http import HttpResponse
7 from django.shortcuts import redirect
8 from django.urls import reverse
9 from django.views.generic import TemplateView, View, CreateView, UpdateView, DeleteView
10 
11 from make_queue.forms import Printer3DCourseForm
12 from make_queue.models.course import Printer3DCourse
13 
14 
15 class CourseView(TemplateView):
16     template_name = "make_queue/course/course_panel.html"
17 
18     def get_context_data(self, **kwargs):
19         context_data = super().get_context_data(**kwargs)
20         context_data.update({
21             "registrations": Printer3DCourse.objects.order_by("name"),
22             "possible_statuses": Printer3DCourse.STATUS_CHOICES,
23         })
24         return context_data
25 
26 
27 class CreateRegistrationView(PermissionRequiredMixin, CreateView):
28     is_next = False
29     model = Printer3DCourse
30     form_class = Printer3DCourseForm
31     template_name = "make_queue/course/registration_create.html"
32     permission_required = (
33         "make_queue.add_printer3dcourse",
34     )
35 
36     def get_context_data(self, **kwargs):
37         context_data = super().get_context_data(**kwargs)
38         if self.is_next:
39             context_data["is_next"] = True
40         return context_data
41 
42     def get_success_url(self):
43         return reverse("create_course_registration_success")
44 
45 
46 class EditRegistrationView(PermissionRequiredMixin, UpdateView):
47     model = Printer3DCourse
48     form_class = Printer3DCourseForm
49     template_name = "make_queue/course/registration_edit.html"
50     permission_required = (
51         "make_queue.change_printer3dcourse",
52     )
53 
54     def get_success_url(self):
55         return reverse("course_panel")
56 
57 
58 class DeleteRegistrationView(PermissionRequiredMixin, DeleteView):
59     model = Printer3DCourse
60     permission_required = (
61         "make_queue.delete_printer3d_course",
62     )
63 
64     def get_success_url(self):
65         return reverse("course_panel")
66 
67 
68 class BulkStatusUpdate(View):
69     """
70     Provides a method for bulk updating the status of course registrations
71     """
72 
73     def post(self, request):
74         status = request.POST.get("status")
75         registrations = list(map(int, request.POST.getlist("users")))
76         Printer3DCourse.objects.filter(pk__in=registrations).update(status=status)
77 
78         return redirect("course_panel")
79 
80 
81 class CourseXLSXView(View):
82 
83     def post(self, request):
84         search_string = request.POST.get("search_text")
85         status_filter = request.POST.get("status_filter")
86 
87         course_registrations = Printer3DCourse.objects.filter(
88             Q(username__icontains=search_string) | Q(name__icontains=search_string), status__icontains=status_filter)
89 
90         # Use an in-memory output file, to avoid having to clean up the disk
91         output_file = io.BytesIO()
92 
93         workbook = xlsxwriter.Workbook(output_file, {"in_memory": True})
94         worksheet = workbook.add_worksheet("Kursdeltagere")
95 
96         # Styles
97         format_header = workbook.add_format({
98             "bold": True,
99             "font_size": 10,
100             "font_name": "Arial",
101             "font_color": "#000000",
102             "bg_color": "#f8c700",
103             "border": 1,
104             "border_color": "#000000",
105         })
106 
107         format_row = workbook.add_format({
108             "font_size": 10,
109             "font_name": "Arial",
110             "font_color": "#000000",
111             "bg_color": "#fff2cc",
112             "border": 1,
113             "border_color": "#000000",
114         })
115 
116         # Set column width
117         worksheet.set_column("A:A", 40)
118         worksheet.set_column("B:B", 20)
119         worksheet.set_column("C:C", 15)
120         worksheet.set_column("D:D", 10)
121 
122         # Header
123         worksheet.write(0, 0, "Navn", format_header)
124         worksheet.write(0, 1, "Brukernavn", format_header)
125         worksheet.write(0, 2, "Kortnummer", format_header)
126         worksheet.write(0, 3, "Dato", format_header)
127 
128         for index, registration in enumerate(course_registrations):
129             worksheet.write(index + 1, 0, registration.name, format_row)
130             worksheet.write(index + 1, 1, registration.username, format_row)
131             worksheet.write(index + 1, 2, registration.card_number if registration.card_number is not None else "",
132                             format_row)
133             worksheet.write(index + 1, 3, registration.date.strftime("%Y-%m-%d"), format_row)
134 
135         workbook.close()
136         output_file.seek(0)
137 
138         response = HttpResponse(output_file.read(),
139                                 content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
140 
141         response['Content-Disposition'] = 'attachment; filename="Kursdeltagere.xlsx"'
142 
143         return response
144
```
--- 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/make_queue/views/admin/course.py b/make_queue/views/admin/course.py
--- a/make_queue/views/admin/course.py
+++ b/make_queue/views/admin/course.py
@@ -58,7 +58,7 @@
 class DeleteRegistrationView(PermissionRequiredMixin, DeleteView):
     model = Printer3DCourse
     permission_required = (
-        "make_queue.delete_printer3d_course",
+        "make_queue.delete_printer3dcourse",
     )
 
     def get_success_url(self):

{"golden_diff": "diff --git a/make_queue/views/admin/course.py b/make_queue/views/admin/course.py\n--- a/make_queue/views/admin/course.py\n+++ b/make_queue/views/admin/course.py\n@@ -58,7 +58,7 @@\n class DeleteRegistrationView(PermissionRequiredMixin, DeleteView):\n     model = Printer3DCourse\n     permission_required = (\n-        \"make_queue.delete_printer3d_course\",\n+        \"make_queue.delete_printer3dcourse\",\n     )\n \n     def get_success_url(self):\n", "issue": "Fix delete permissions for course registration\n\n", "before_files": [{"content": "import io\n\nimport xlsxwriter\nfrom django.contrib.auth.mixins import PermissionRequiredMixin\nfrom django.db.models import Q\nfrom django.http import HttpResponse\nfrom django.shortcuts import redirect\nfrom django.urls import reverse\nfrom django.views.generic import TemplateView, View, CreateView, UpdateView, DeleteView\n\nfrom make_queue.forms import Printer3DCourseForm\nfrom make_queue.models.course import Printer3DCourse\n\n\nclass CourseView(TemplateView):\n    template_name = \"make_queue/course/course_panel.html\"\n\n    def get_context_data(self, **kwargs):\n        context_data = super().get_context_data(**kwargs)\n        context_data.update({\n            \"registrations\": Printer3DCourse.objects.order_by(\"name\"),\n            \"possible_statuses\": Printer3DCourse.STATUS_CHOICES,\n        })\n        return context_data\n\n\nclass CreateRegistrationView(PermissionRequiredMixin, CreateView):\n    is_next = False\n    model = Printer3DCourse\n    form_class = Printer3DCourseForm\n    template_name = \"make_queue/course/registration_create.html\"\n    permission_required = (\n        \"make_queue.add_printer3dcourse\",\n    )\n\n    def get_context_data(self, **kwargs):\n        context_data = super().get_context_data(**kwargs)\n        if self.is_next:\n            context_data[\"is_next\"] = True\n        return context_data\n\n    def get_success_url(self):\n        return reverse(\"create_course_registration_success\")\n\n\nclass EditRegistrationView(PermissionRequiredMixin, UpdateView):\n    model = Printer3DCourse\n    form_class = Printer3DCourseForm\n    template_name = \"make_queue/course/registration_edit.html\"\n    permission_required = (\n        \"make_queue.change_printer3dcourse\",\n    )\n\n    def get_success_url(self):\n        return reverse(\"course_panel\")\n\n\nclass DeleteRegistrationView(PermissionRequiredMixin, DeleteView):\n    model = Printer3DCourse\n    permission_required = (\n        \"make_queue.delete_printer3d_course\",\n    )\n\n    def get_success_url(self):\n        return reverse(\"course_panel\")\n\n\nclass BulkStatusUpdate(View):\n    \"\"\"\n    Provides a method for bulk updating the status of course registrations\n    \"\"\"\n\n    def post(self, request):\n        status = request.POST.get(\"status\")\n        registrations = list(map(int, request.POST.getlist(\"users\")))\n        Printer3DCourse.objects.filter(pk__in=registrations).update(status=status)\n\n        return redirect(\"course_panel\")\n\n\nclass CourseXLSXView(View):\n\n    def post(self, request):\n        search_string = request.POST.get(\"search_text\")\n        status_filter = request.POST.get(\"status_filter\")\n\n        course_registrations = Printer3DCourse.objects.filter(\n            Q(username__icontains=search_string) | Q(name__icontains=search_string), status__icontains=status_filter)\n\n        # Use an in-memory output file, to avoid having to clean up the disk\n        output_file = io.BytesIO()\n\n        workbook = xlsxwriter.Workbook(output_file, {\"in_memory\": True})\n        worksheet = workbook.add_worksheet(\"Kursdeltagere\")\n\n        # Styles\n        format_header = workbook.add_format({\n            \"bold\": True,\n            \"font_size\": 10,\n            \"font_name\": \"Arial\",\n            \"font_color\": \"#000000\",\n            \"bg_color\": \"#f8c700\",\n            \"border\": 1,\n            \"border_color\": \"#000000\",\n        })\n\n        format_row = workbook.add_format({\n            \"font_size\": 10,\n            \"font_name\": \"Arial\",\n            \"font_color\": \"#000000\",\n            \"bg_color\": \"#fff2cc\",\n            \"border\": 1,\n            \"border_color\": \"#000000\",\n        })\n\n        # Set column width\n        worksheet.set_column(\"A:A\", 40)\n        worksheet.set_column(\"B:B\", 20)\n        worksheet.set_column(\"C:C\", 15)\n        worksheet.set_column(\"D:D\", 10)\n\n        # Header\n        worksheet.write(0, 0, \"Navn\", format_header)\n        worksheet.write(0, 1, \"Brukernavn\", format_header)\n        worksheet.write(0, 2, \"Kortnummer\", format_header)\n        worksheet.write(0, 3, \"Dato\", format_header)\n\n        for index, registration in enumerate(course_registrations):\n            worksheet.write(index + 1, 0, registration.name, format_row)\n            worksheet.write(index + 1, 1, registration.username, format_row)\n            worksheet.write(index + 1, 2, registration.card_number if registration.card_number is not None else \"\",\n                            format_row)\n            worksheet.write(index + 1, 3, registration.date.strftime(\"%Y-%m-%d\"), format_row)\n\n        workbook.close()\n        output_file.seek(0)\n\n        response = HttpResponse(output_file.read(),\n                                content_type=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\")\n\n        response['Content-Disposition'] = 'attachment; filename=\"Kursdeltagere.xlsx\"'\n\n        return response\n", "path": "make_queue/views/admin/course.py"}], "after_files": [{"content": "import io\n\nimport xlsxwriter\nfrom django.contrib.auth.mixins import PermissionRequiredMixin\nfrom django.db.models import Q\nfrom django.http import HttpResponse\nfrom django.shortcuts import redirect\nfrom django.urls import reverse\nfrom django.views.generic import TemplateView, View, CreateView, UpdateView, DeleteView\n\nfrom make_queue.forms import Printer3DCourseForm\nfrom make_queue.models.course import Printer3DCourse\n\n\nclass CourseView(TemplateView):\n    template_name = \"make_queue/course/course_panel.html\"\n\n    def get_context_data(self, **kwargs):\n        context_data = super().get_context_data(**kwargs)\n        context_data.update({\n            \"registrations\": Printer3DCourse.objects.order_by(\"name\"),\n            \"possible_statuses\": Printer3DCourse.STATUS_CHOICES,\n        })\n        return context_data\n\n\nclass CreateRegistrationView(PermissionRequiredMixin, CreateView):\n    is_next = False\n    model = Printer3DCourse\n    form_class = Printer3DCourseForm\n    template_name = \"make_queue/course/registration_create.html\"\n    permission_required = (\n        \"make_queue.add_printer3dcourse\",\n    )\n\n    def get_context_data(self, **kwargs):\n        context_data = super().get_context_data(**kwargs)\n        if self.is_next:\n            context_data[\"is_next\"] = True\n        return context_data\n\n    def get_success_url(self):\n        return reverse(\"create_course_registration_success\")\n\n\nclass EditRegistrationView(PermissionRequiredMixin, UpdateView):\n    model = Printer3DCourse\n    form_class = Printer3DCourseForm\n    template_name = \"make_queue/course/registration_edit.html\"\n    permission_required = (\n        \"make_queue.change_printer3dcourse\",\n    )\n\n    def get_success_url(self):\n        return reverse(\"course_panel\")\n\n\nclass DeleteRegistrationView(PermissionRequiredMixin, DeleteView):\n    model = Printer3DCourse\n    permission_required = (\n        \"make_queue.delete_printer3dcourse\",\n    )\n\n    def get_success_url(self):\n        return reverse(\"course_panel\")\n\n\nclass BulkStatusUpdate(View):\n    \"\"\"\n    Provides a method for bulk updating the status of course registrations\n    \"\"\"\n\n    def post(self, request):\n        status = request.POST.get(\"status\")\n        registrations = list(map(int, request.POST.getlist(\"users\")))\n        Printer3DCourse.objects.filter(pk__in=registrations).update(status=status)\n\n        return redirect(\"course_panel\")\n\n\nclass CourseXLSXView(View):\n\n    def post(self, request):\n        search_string = request.POST.get(\"search_text\")\n        status_filter = request.POST.get(\"status_filter\")\n\n        course_registrations = Printer3DCourse.objects.filter(\n            Q(username__icontains=search_string) | Q(name__icontains=search_string), status__icontains=status_filter)\n\n        # Use an in-memory output file, to avoid having to clean up the disk\n        output_file = io.BytesIO()\n\n        workbook = xlsxwriter.Workbook(output_file, {\"in_memory\": True})\n        worksheet = workbook.add_worksheet(\"Kursdeltagere\")\n\n        # Styles\n        format_header = workbook.add_format({\n            \"bold\": True,\n            \"font_size\": 10,\n            \"font_name\": \"Arial\",\n            \"font_color\": \"#000000\",\n            \"bg_color\": \"#f8c700\",\n            \"border\": 1,\n            \"border_color\": \"#000000\",\n        })\n\n        format_row = workbook.add_format({\n            \"font_size\": 10,\n            \"font_name\": \"Arial\",\n            \"font_color\": \"#000000\",\n            \"bg_color\": \"#fff2cc\",\n            \"border\": 1,\n            \"border_color\": \"#000000\",\n        })\n\n        # Set column width\n        worksheet.set_column(\"A:A\", 40)\n        worksheet.set_column(\"B:B\", 20)\n        worksheet.set_column(\"C:C\", 15)\n        worksheet.set_column(\"D:D\", 10)\n\n        # Header\n        worksheet.write(0, 0, \"Navn\", format_header)\n        worksheet.write(0, 1, \"Brukernavn\", format_header)\n        worksheet.write(0, 2, \"Kortnummer\", format_header)\n        worksheet.write(0, 3, \"Dato\", format_header)\n\n        for index, registration in enumerate(course_registrations):\n            worksheet.write(index + 1, 0, registration.name, format_row)\n            worksheet.write(index + 1, 1, registration.username, format_row)\n            worksheet.write(index + 1, 2, registration.card_number if registration.card_number is not None else \"\",\n                            format_row)\n            worksheet.write(index + 1, 3, registration.date.strftime(\"%Y-%m-%d\"), format_row)\n\n        workbook.close()\n        output_file.seek(0)\n\n        response = HttpResponse(output_file.read(),\n                                content_type=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\")\n\n        response['Content-Disposition'] = 'attachment; filename=\"Kursdeltagere.xlsx\"'\n\n        return response\n", "path": "make_queue/views/admin/course.py"}]}