We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Markdown preview fails CSRF validation checks
Caused by the name change of the CSRF cookie.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `app/grandchallenge/core/widgets.py`
Content:
```
1 from django import forms
2 from markdownx.widgets import AdminMarkdownxWidget, MarkdownxWidget
3 
4 
5 class JSONEditorWidget(forms.Textarea):
6     template_name = "jsoneditor/jsoneditor_widget.html"
7 
8     def __init__(self, schema=None, attrs=None):
9         super().__init__(attrs)
10         self.schema = schema
11 
12     def get_context(self, name, value, attrs):
13         context = super().get_context(name, value, attrs)
14         context.update({"schema": self.schema})
15         return context
16 
17     class Media:
18         css = {
19             "all": (
20                 "https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/5.25.0/jsoneditor.min.css",
21             )
22         }
23         js = (
24             "https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/5.25.0/jsoneditor.min.js",
25         )
26 
27 
28 class MarkdownEditorWidget(MarkdownxWidget):
29     class Media(MarkdownxWidget.Media):
30         js = [
31             *MarkdownxWidget.Media.js,
32             "vendor/js/markdown-toolbar-element/index.umd.js",
33         ]
34 
35 
36 class MarkdownEditorAdminWidget(AdminMarkdownxWidget):
37     class Media(AdminMarkdownxWidget.Media):
38         css = {
39             "all": [
40                 *AdminMarkdownxWidget.Media.css["all"],
41                 "vendor/css/base.min.css",
42                 "vendor/fa/css/all.css",
43             ]
44         }
45         js = [
46             *AdminMarkdownxWidget.Media.js,
47             "vendor/js/markdown-toolbar-element/index.umd.js",
48         ]
49
```
--- 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/app/grandchallenge/core/widgets.py b/app/grandchallenge/core/widgets.py
--- a/app/grandchallenge/core/widgets.py
+++ b/app/grandchallenge/core/widgets.py
@@ -26,23 +26,29 @@
 
 
 class MarkdownEditorWidget(MarkdownxWidget):
-    class Media(MarkdownxWidget.Media):
-        js = [
-            *MarkdownxWidget.Media.js,
-            "vendor/js/markdown-toolbar-element/index.umd.js",
-        ]
+    @property
+    def media(self):
+        return forms.Media(
+            js=(
+                "js/markdownx.js",
+                "vendor/js/markdown-toolbar-element/index.umd.js",
+            )
+        )
 
 
 class MarkdownEditorAdminWidget(AdminMarkdownxWidget):
-    class Media(AdminMarkdownxWidget.Media):
-        css = {
-            "all": [
-                *AdminMarkdownxWidget.Media.css["all"],
-                "vendor/css/base.min.css",
-                "vendor/fa/css/all.css",
-            ]
-        }
-        js = [
-            *AdminMarkdownxWidget.Media.js,
-            "vendor/js/markdown-toolbar-element/index.umd.js",
-        ]
+    @property
+    def media(self):
+        return forms.Media(
+            css={
+                "all": [
+                    *AdminMarkdownxWidget.Media.css["all"],
+                    "vendor/css/base.min.css",
+                    "vendor/fa/css/all.css",
+                ]
+            },
+            js=[
+                "js/markdownx.js",
+                "vendor/js/markdown-toolbar-element/index.umd.js",
+            ],
+        )

{"golden_diff": "diff --git a/app/grandchallenge/core/widgets.py b/app/grandchallenge/core/widgets.py\n--- a/app/grandchallenge/core/widgets.py\n+++ b/app/grandchallenge/core/widgets.py\n@@ -26,23 +26,29 @@\n \n \n class MarkdownEditorWidget(MarkdownxWidget):\n-    class Media(MarkdownxWidget.Media):\n-        js = [\n-            *MarkdownxWidget.Media.js,\n-            \"vendor/js/markdown-toolbar-element/index.umd.js\",\n-        ]\n+    @property\n+    def media(self):\n+        return forms.Media(\n+            js=(\n+                \"js/markdownx.js\",\n+                \"vendor/js/markdown-toolbar-element/index.umd.js\",\n+            )\n+        )\n \n \n class MarkdownEditorAdminWidget(AdminMarkdownxWidget):\n-    class Media(AdminMarkdownxWidget.Media):\n-        css = {\n-            \"all\": [\n-                *AdminMarkdownxWidget.Media.css[\"all\"],\n-                \"vendor/css/base.min.css\",\n-                \"vendor/fa/css/all.css\",\n-            ]\n-        }\n-        js = [\n-            *AdminMarkdownxWidget.Media.js,\n-            \"vendor/js/markdown-toolbar-element/index.umd.js\",\n-        ]\n+    @property\n+    def media(self):\n+        return forms.Media(\n+            css={\n+                \"all\": [\n+                    *AdminMarkdownxWidget.Media.css[\"all\"],\n+                    \"vendor/css/base.min.css\",\n+                    \"vendor/fa/css/all.css\",\n+                ]\n+            },\n+            js=[\n+                \"js/markdownx.js\",\n+                \"vendor/js/markdown-toolbar-element/index.umd.js\",\n+            ],\n+        )\n", "issue": "Markdown preview fails CSRF validation checks\nCaused by the name change of the CSRF cookie.\n", "before_files": [{"content": "from django import forms\nfrom markdownx.widgets import AdminMarkdownxWidget, MarkdownxWidget\n\n\nclass JSONEditorWidget(forms.Textarea):\n    template_name = \"jsoneditor/jsoneditor_widget.html\"\n\n    def __init__(self, schema=None, attrs=None):\n        super().__init__(attrs)\n        self.schema = schema\n\n    def get_context(self, name, value, attrs):\n        context = super().get_context(name, value, attrs)\n        context.update({\"schema\": self.schema})\n        return context\n\n    class Media:\n        css = {\n            \"all\": (\n                \"https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/5.25.0/jsoneditor.min.css\",\n            )\n        }\n        js = (\n            \"https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/5.25.0/jsoneditor.min.js\",\n        )\n\n\nclass MarkdownEditorWidget(MarkdownxWidget):\n    class Media(MarkdownxWidget.Media):\n        js = [\n            *MarkdownxWidget.Media.js,\n            \"vendor/js/markdown-toolbar-element/index.umd.js\",\n        ]\n\n\nclass MarkdownEditorAdminWidget(AdminMarkdownxWidget):\n    class Media(AdminMarkdownxWidget.Media):\n        css = {\n            \"all\": [\n                *AdminMarkdownxWidget.Media.css[\"all\"],\n                \"vendor/css/base.min.css\",\n                \"vendor/fa/css/all.css\",\n            ]\n        }\n        js = [\n            *AdminMarkdownxWidget.Media.js,\n            \"vendor/js/markdown-toolbar-element/index.umd.js\",\n        ]\n", "path": "app/grandchallenge/core/widgets.py"}], "after_files": [{"content": "from django import forms\nfrom markdownx.widgets import AdminMarkdownxWidget, MarkdownxWidget\n\n\nclass JSONEditorWidget(forms.Textarea):\n    template_name = \"jsoneditor/jsoneditor_widget.html\"\n\n    def __init__(self, schema=None, attrs=None):\n        super().__init__(attrs)\n        self.schema = schema\n\n    def get_context(self, name, value, attrs):\n        context = super().get_context(name, value, attrs)\n        context.update({\"schema\": self.schema})\n        return context\n\n    class Media:\n        css = {\n            \"all\": (\n                \"https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/5.25.0/jsoneditor.min.css\",\n            )\n        }\n        js = (\n            \"https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/5.25.0/jsoneditor.min.js\",\n        )\n\n\nclass MarkdownEditorWidget(MarkdownxWidget):\n    @property\n    def media(self):\n        return forms.Media(\n            js=(\n                \"js/markdownx.js\",\n                \"vendor/js/markdown-toolbar-element/index.umd.js\",\n            )\n        )\n\n\nclass MarkdownEditorAdminWidget(AdminMarkdownxWidget):\n    @property\n    def media(self):\n        return forms.Media(\n            css={\n                \"all\": [\n                    *AdminMarkdownxWidget.Media.css[\"all\"],\n                    \"vendor/css/base.min.css\",\n                    \"vendor/fa/css/all.css\",\n                ]\n            },\n            js=[\n                \"js/markdownx.js\",\n                \"vendor/js/markdown-toolbar-element/index.umd.js\",\n            ],\n        )\n", "path": "app/grandchallenge/core/widgets.py"}]}