We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Increase speed of CSV export
### Describe the Bug
<!-- A clear and concise description of what the bug is. -->
#2593 introduced the option to export region feedback to CSV. However the testing on production and test server showed that in it's current state the export is very slow (~17s on production).

### Steps to Reproduce

1. Go to Testumgebung on the production server
2. Click on Feedback
3. Select an arbitrary amount of feedback entries
4. Open up network analysis in browser
5. Run the bulk action "export to CSV"
6. See that the action takes a few seconds

### Expected Behavior
<!-- A clear and concise description of what you expected to happen. -->
I'm not sure what a good threshold would be - maybe the standard 4s?

### Actual Behavior
<!-- A clear and concise description of what actually happened. -->
It takes considerably longer - around 17s in my test cases.

### Additional Information
<!-- Add any other context (e.g. logs, screenshots, etc.) about the problem here. -->

While testing this I noticed that the amount of selected feedback didn't really have an effect on the performance. Exporting 1 and 16 pages took the same loading time (the above mentioned 17s). I'm not sure if this is relevant, but I still wanted to mention it.

<details>
  <summary>Traceback</summary>

  ```
  ```

</details>


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `integreat_cms/cms/views/feedback/region_feedback_actions.py`
Content:
```
1 """
2 This module contains action methods for feedback items (archive, restore, ...)
3 """
4 
5 from __future__ import annotations
6 
7 import logging
8 from typing import TYPE_CHECKING
9 
10 import magic
11 from cacheops import invalidate_model, invalidate_obj
12 from django.contrib import messages
13 from django.http import HttpResponse
14 from django.shortcuts import redirect
15 from django.utils.translation import gettext_lazy as _
16 from django.views.decorators.http import require_POST
17 from tablib import Dataset
18 from tablib.formats import registry as format_registry
19 
20 from ...decorators import permission_required
21 from ...models import Feedback
22 from .feedback_resource import FeedbackResource
23 
24 if TYPE_CHECKING:
25     from django.http import HttpRequest, HttpResponseRedirect
26 
27 logger = logging.getLogger(__name__)
28 
29 
30 @require_POST
31 @permission_required("cms.change_feedback")
32 def mark_region_feedback_as_read(
33     request: HttpRequest, region_slug: str
34 ) -> HttpResponseRedirect:
35     """
36     Set read flag for a list of feedback items
37 
38     :param request: Object representing the user call
39     :param region_slug: The slug of the current region
40     :return: A redirection to the region feedback list
41     """
42 
43     region = request.region
44 
45     selected_ids = request.POST.getlist("selected_ids[]")
46     selected_feedback = Feedback.objects.filter(
47         id__in=selected_ids, region=region, is_technical=False
48     )
49     for feedback in selected_feedback:
50         invalidate_obj(feedback)
51         if hasattr(feedback, "feedback_ptr"):
52             invalidate_obj(feedback.feedback_ptr)
53     selected_feedback.update(read_by=request.user)
54 
55     logger.debug(
56         "Feedback objects %r marked as read by %r",
57         selected_ids,
58         request.user,
59     )
60     messages.success(request, _("Feedback was successfully marked as read"))
61 
62     return redirect("region_feedback", region_slug=region_slug)
63 
64 
65 @require_POST
66 @permission_required("cms.change_feedback")
67 def mark_region_feedback_as_unread(
68     request: HttpRequest, region_slug: str
69 ) -> HttpResponseRedirect:
70     """
71     Unset read flag for a list of feedback items
72 
73     :param request: Object representing the user call
74     :param region_slug: The slug of the current region
75     :return: A redirection to the region feedback list
76     """
77 
78     region = request.region
79 
80     selected_ids = request.POST.getlist("selected_ids[]")
81     selected_feedback = Feedback.objects.filter(
82         id__in=selected_ids, region=region, is_technical=False
83     )
84     for feedback in selected_feedback:
85         invalidate_obj(feedback)
86         if hasattr(feedback, "feedback_ptr"):
87             invalidate_obj(feedback.feedback_ptr)
88     selected_feedback.update(read_by=None)
89 
90     logger.debug(
91         "Feedback objects %r marked as unread by %r",
92         selected_ids,
93         request.user,
94     )
95     messages.success(request, _("Feedback was successfully marked as unread"))
96 
97     return redirect("region_feedback", region_slug=region_slug)
98 
99 
100 @require_POST
101 @permission_required("cms.change_feedback")
102 def archive_region_feedback(
103     request: HttpRequest, region_slug: str
104 ) -> HttpResponseRedirect:
105     """
106     Archive a list of feedback items
107 
108     :param request: Object representing the user call
109     :param region_slug: The slug of the current region
110     :return: A redirection to the region feedback list
111     """
112 
113     region = request.region
114 
115     selected_ids = request.POST.getlist("selected_ids[]")
116     Feedback.objects.filter(
117         id__in=selected_ids, region=region, is_technical=False
118     ).update(archived=True)
119     invalidate_model(Feedback)
120 
121     logger.info("Feedback objects %r archived by %r", selected_ids, request.user)
122     messages.success(request, _("Feedback was successfully archived"))
123 
124     return redirect("region_feedback", region_slug=region_slug)
125 
126 
127 @require_POST
128 @permission_required("cms.change_feedback")
129 def restore_region_feedback(
130     request: HttpRequest, region_slug: str
131 ) -> HttpResponseRedirect:
132     """
133     Restore a list of feedback items
134 
135     :param request: Object representing the user call
136     :param region_slug: The slug of the current region
137     :return: A redirection to the region feedback list
138     """
139 
140     region = request.region
141 
142     selected_ids = request.POST.getlist("selected_ids[]")
143     Feedback.objects.filter(
144         id__in=selected_ids, region=region, is_technical=False
145     ).update(archived=False)
146     invalidate_model(Feedback)
147 
148     logger.info("Feedback objects %r restored by %r", selected_ids, request.user)
149     messages.success(request, _("Feedback was successfully restored"))
150 
151     return redirect("region_feedback_archived", region_slug=region_slug)
152 
153 
154 @require_POST
155 @permission_required("cms.delete_feedback")
156 def delete_region_feedback(
157     request: HttpRequest, region_slug: str
158 ) -> HttpResponseRedirect:
159     """
160     Delete a list of feedback items
161 
162     :param request: Object representing the user call
163     :param region_slug: The slug of the current region
164     :return: A redirection to the region feedback list
165     """
166 
167     region = request.region
168 
169     selected_ids = request.POST.getlist("selected_ids[]")
170     Feedback.objects.filter(
171         id__in=selected_ids, region=region, is_technical=False
172     ).delete()
173 
174     logger.info("Feedback objects %r deleted by %r", selected_ids, request.user)
175     messages.success(request, _("Feedback was successfully deleted"))
176 
177     return redirect("region_feedback", region_slug=region_slug)
178 
179 
180 # pylint: disable=unused-argument
181 @require_POST
182 @permission_required("cms.view_feedback")
183 def export_region_feedback(
184     request: HttpRequest,
185     region_slug: str,
186     file_format: str,
187 ) -> HttpResponse:
188     """
189     Export a list of feedback items
190 
191     :param request: Object representing the user call
192     :param region_slug: The slug of the current region
193     :param file_format: The export format
194     :return: Response with file
195     """
196     selected_ids = request.POST.getlist("selected_ids[]")
197     selected_feedback = Feedback.objects.filter(
198         id__in=selected_ids, region=request.region, is_technical=False
199     )
200 
201     resource = FeedbackResource()
202     dataset = Dataset()
203 
204     headers = resource.export().headers
205     dataset.headers = headers
206 
207     for obj in selected_feedback:
208         data = resource.export_resource(obj)
209         dataset.append(data)
210 
211     if file_format in (f.title for f in format_registry.formats()):
212         blob = getattr(dataset, file_format)
213         mime = magic.from_buffer(blob, mime=True)
214         response = HttpResponse(blob, content_type=mime)
215     else:
216         raise ValueError(f"Unknown export format {file_format}")
217     response["Content-Disposition"] = (
218         f'attachment; filename="Integreat_{request.region}_feedback.{file_format}'
219     )
220     return response
221
```
--- 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/integreat_cms/cms/views/feedback/region_feedback_actions.py b/integreat_cms/cms/views/feedback/region_feedback_actions.py
--- a/integreat_cms/cms/views/feedback/region_feedback_actions.py
+++ b/integreat_cms/cms/views/feedback/region_feedback_actions.py
@@ -199,14 +199,10 @@
     )
 
     resource = FeedbackResource()
-    dataset = Dataset()
-
-    headers = resource.export().headers
-    dataset.headers = headers
-
-    for obj in selected_feedback:
-        data = resource.export_resource(obj)
-        dataset.append(data)
+    dataset = Dataset(
+        *(resource.export_resource(obj) for obj in selected_feedback),
+        headers=resource.export().headers,
+    )
 
     if file_format in (f.title for f in format_registry.formats()):
         blob = getattr(dataset, file_format)

{"golden_diff": "diff --git a/integreat_cms/cms/views/feedback/region_feedback_actions.py b/integreat_cms/cms/views/feedback/region_feedback_actions.py\n--- a/integreat_cms/cms/views/feedback/region_feedback_actions.py\n+++ b/integreat_cms/cms/views/feedback/region_feedback_actions.py\n@@ -199,14 +199,10 @@\n     )\n \n     resource = FeedbackResource()\n-    dataset = Dataset()\n-\n-    headers = resource.export().headers\n-    dataset.headers = headers\n-\n-    for obj in selected_feedback:\n-        data = resource.export_resource(obj)\n-        dataset.append(data)\n+    dataset = Dataset(\n+        *(resource.export_resource(obj) for obj in selected_feedback),\n+        headers=resource.export().headers,\n+    )\n \n     if file_format in (f.title for f in format_registry.formats()):\n         blob = getattr(dataset, file_format)\n", "issue": "Increase speed of CSV export\n### Describe the Bug\r\n<!-- A clear and concise description of what the bug is. -->\r\n#2593 introduced the option to export region feedback to CSV. However the testing on production and test server showed that in it's current state the export is very slow (~17s on production).\r\n\r\n### Steps to Reproduce\r\n\r\n1. Go to Testumgebung on the production server\r\n2. Click on Feedback\r\n3. Select an arbitrary amount of feedback entries\r\n4. Open up network analysis in browser\r\n5. Run the bulk action \"export to CSV\"\r\n6. See that the action takes a few seconds\r\n\r\n### Expected Behavior\r\n<!-- A clear and concise description of what you expected to happen. -->\r\nI'm not sure what a good threshold would be - maybe the standard 4s?\r\n\r\n### Actual Behavior\r\n<!-- A clear and concise description of what actually happened. -->\r\nIt takes considerably longer - around 17s in my test cases.\r\n\r\n### Additional Information\r\n<!-- Add any other context (e.g. logs, screenshots, etc.) about the problem here. -->\r\n\r\nWhile testing this I noticed that the amount of selected feedback didn't really have an effect on the performance. Exporting 1 and 16 pages took the same loading time (the above mentioned 17s). I'm not sure if this is relevant, but I still wanted to mention it.\r\n\r\n<details>\r\n  <summary>Traceback</summary>\r\n\r\n  ```\r\n  ```\r\n\r\n</details>\r\n\n", "before_files": [{"content": "\"\"\"\nThis module contains action methods for feedback items (archive, restore, ...)\n\"\"\"\n\nfrom __future__ import annotations\n\nimport logging\nfrom typing import TYPE_CHECKING\n\nimport magic\nfrom cacheops import invalidate_model, invalidate_obj\nfrom django.contrib import messages\nfrom django.http import HttpResponse\nfrom django.shortcuts import redirect\nfrom django.utils.translation import gettext_lazy as _\nfrom django.views.decorators.http import require_POST\nfrom tablib import Dataset\nfrom tablib.formats import registry as format_registry\n\nfrom ...decorators import permission_required\nfrom ...models import Feedback\nfrom .feedback_resource import FeedbackResource\n\nif TYPE_CHECKING:\n    from django.http import HttpRequest, HttpResponseRedirect\n\nlogger = logging.getLogger(__name__)\n\n\n@require_POST\n@permission_required(\"cms.change_feedback\")\ndef mark_region_feedback_as_read(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Set read flag for a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    selected_feedback = Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    )\n    for feedback in selected_feedback:\n        invalidate_obj(feedback)\n        if hasattr(feedback, \"feedback_ptr\"):\n            invalidate_obj(feedback.feedback_ptr)\n    selected_feedback.update(read_by=request.user)\n\n    logger.debug(\n        \"Feedback objects %r marked as read by %r\",\n        selected_ids,\n        request.user,\n    )\n    messages.success(request, _(\"Feedback was successfully marked as read\"))\n\n    return redirect(\"region_feedback\", region_slug=region_slug)\n\n\n@require_POST\n@permission_required(\"cms.change_feedback\")\ndef mark_region_feedback_as_unread(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Unset read flag for a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    selected_feedback = Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    )\n    for feedback in selected_feedback:\n        invalidate_obj(feedback)\n        if hasattr(feedback, \"feedback_ptr\"):\n            invalidate_obj(feedback.feedback_ptr)\n    selected_feedback.update(read_by=None)\n\n    logger.debug(\n        \"Feedback objects %r marked as unread by %r\",\n        selected_ids,\n        request.user,\n    )\n    messages.success(request, _(\"Feedback was successfully marked as unread\"))\n\n    return redirect(\"region_feedback\", region_slug=region_slug)\n\n\n@require_POST\n@permission_required(\"cms.change_feedback\")\ndef archive_region_feedback(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Archive a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    ).update(archived=True)\n    invalidate_model(Feedback)\n\n    logger.info(\"Feedback objects %r archived by %r\", selected_ids, request.user)\n    messages.success(request, _(\"Feedback was successfully archived\"))\n\n    return redirect(\"region_feedback\", region_slug=region_slug)\n\n\n@require_POST\n@permission_required(\"cms.change_feedback\")\ndef restore_region_feedback(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Restore a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    ).update(archived=False)\n    invalidate_model(Feedback)\n\n    logger.info(\"Feedback objects %r restored by %r\", selected_ids, request.user)\n    messages.success(request, _(\"Feedback was successfully restored\"))\n\n    return redirect(\"region_feedback_archived\", region_slug=region_slug)\n\n\n@require_POST\n@permission_required(\"cms.delete_feedback\")\ndef delete_region_feedback(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Delete a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    ).delete()\n\n    logger.info(\"Feedback objects %r deleted by %r\", selected_ids, request.user)\n    messages.success(request, _(\"Feedback was successfully deleted\"))\n\n    return redirect(\"region_feedback\", region_slug=region_slug)\n\n\n# pylint: disable=unused-argument\n@require_POST\n@permission_required(\"cms.view_feedback\")\ndef export_region_feedback(\n    request: HttpRequest,\n    region_slug: str,\n    file_format: str,\n) -> HttpResponse:\n    \"\"\"\n    Export a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :param file_format: The export format\n    :return: Response with file\n    \"\"\"\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    selected_feedback = Feedback.objects.filter(\n        id__in=selected_ids, region=request.region, is_technical=False\n    )\n\n    resource = FeedbackResource()\n    dataset = Dataset()\n\n    headers = resource.export().headers\n    dataset.headers = headers\n\n    for obj in selected_feedback:\n        data = resource.export_resource(obj)\n        dataset.append(data)\n\n    if file_format in (f.title for f in format_registry.formats()):\n        blob = getattr(dataset, file_format)\n        mime = magic.from_buffer(blob, mime=True)\n        response = HttpResponse(blob, content_type=mime)\n    else:\n        raise ValueError(f\"Unknown export format {file_format}\")\n    response[\"Content-Disposition\"] = (\n        f'attachment; filename=\"Integreat_{request.region}_feedback.{file_format}'\n    )\n    return response\n", "path": "integreat_cms/cms/views/feedback/region_feedback_actions.py"}], "after_files": [{"content": "\"\"\"\nThis module contains action methods for feedback items (archive, restore, ...)\n\"\"\"\n\nfrom __future__ import annotations\n\nimport logging\nfrom typing import TYPE_CHECKING\n\nimport magic\nfrom cacheops import invalidate_model, invalidate_obj\nfrom django.contrib import messages\nfrom django.http import HttpResponse\nfrom django.shortcuts import redirect\nfrom django.utils.translation import gettext_lazy as _\nfrom django.views.decorators.http import require_POST\nfrom tablib import Dataset\nfrom tablib.formats import registry as format_registry\n\nfrom ...decorators import permission_required\nfrom ...models import Feedback\nfrom .feedback_resource import FeedbackResource\n\nif TYPE_CHECKING:\n    from django.http import HttpRequest, HttpResponseRedirect\n\nlogger = logging.getLogger(__name__)\n\n\n@require_POST\n@permission_required(\"cms.change_feedback\")\ndef mark_region_feedback_as_read(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Set read flag for a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    selected_feedback = Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    )\n    for feedback in selected_feedback:\n        invalidate_obj(feedback)\n        if hasattr(feedback, \"feedback_ptr\"):\n            invalidate_obj(feedback.feedback_ptr)\n    selected_feedback.update(read_by=request.user)\n\n    logger.debug(\n        \"Feedback objects %r marked as read by %r\",\n        selected_ids,\n        request.user,\n    )\n    messages.success(request, _(\"Feedback was successfully marked as read\"))\n\n    return redirect(\"region_feedback\", region_slug=region_slug)\n\n\n@require_POST\n@permission_required(\"cms.change_feedback\")\ndef mark_region_feedback_as_unread(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Unset read flag for a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    selected_feedback = Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    )\n    for feedback in selected_feedback:\n        invalidate_obj(feedback)\n        if hasattr(feedback, \"feedback_ptr\"):\n            invalidate_obj(feedback.feedback_ptr)\n    selected_feedback.update(read_by=None)\n\n    logger.debug(\n        \"Feedback objects %r marked as unread by %r\",\n        selected_ids,\n        request.user,\n    )\n    messages.success(request, _(\"Feedback was successfully marked as unread\"))\n\n    return redirect(\"region_feedback\", region_slug=region_slug)\n\n\n@require_POST\n@permission_required(\"cms.change_feedback\")\ndef archive_region_feedback(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Archive a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    ).update(archived=True)\n    invalidate_model(Feedback)\n\n    logger.info(\"Feedback objects %r archived by %r\", selected_ids, request.user)\n    messages.success(request, _(\"Feedback was successfully archived\"))\n\n    return redirect(\"region_feedback\", region_slug=region_slug)\n\n\n@require_POST\n@permission_required(\"cms.change_feedback\")\ndef restore_region_feedback(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Restore a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    ).update(archived=False)\n    invalidate_model(Feedback)\n\n    logger.info(\"Feedback objects %r restored by %r\", selected_ids, request.user)\n    messages.success(request, _(\"Feedback was successfully restored\"))\n\n    return redirect(\"region_feedback_archived\", region_slug=region_slug)\n\n\n@require_POST\n@permission_required(\"cms.delete_feedback\")\ndef delete_region_feedback(\n    request: HttpRequest, region_slug: str\n) -> HttpResponseRedirect:\n    \"\"\"\n    Delete a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :return: A redirection to the region feedback list\n    \"\"\"\n\n    region = request.region\n\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    Feedback.objects.filter(\n        id__in=selected_ids, region=region, is_technical=False\n    ).delete()\n\n    logger.info(\"Feedback objects %r deleted by %r\", selected_ids, request.user)\n    messages.success(request, _(\"Feedback was successfully deleted\"))\n\n    return redirect(\"region_feedback\", region_slug=region_slug)\n\n\n# pylint: disable=unused-argument\n@require_POST\n@permission_required(\"cms.view_feedback\")\ndef export_region_feedback(\n    request: HttpRequest,\n    region_slug: str,\n    file_format: str,\n) -> HttpResponse:\n    \"\"\"\n    Export a list of feedback items\n\n    :param request: Object representing the user call\n    :param region_slug: The slug of the current region\n    :param file_format: The export format\n    :return: Response with file\n    \"\"\"\n    selected_ids = request.POST.getlist(\"selected_ids[]\")\n    selected_feedback = Feedback.objects.filter(\n        id__in=selected_ids, region=request.region, is_technical=False\n    )\n\n    resource = FeedbackResource()\n    dataset = Dataset(\n        *(resource.export_resource(obj) for obj in selected_feedback),\n        headers=resource.export().headers,\n    )\n\n    if file_format in (f.title for f in format_registry.formats()):\n        blob = getattr(dataset, file_format)\n        mime = magic.from_buffer(blob, mime=True)\n        response = HttpResponse(blob, content_type=mime)\n    else:\n        raise ValueError(f\"Unknown export format {file_format}\")\n    response[\"Content-Disposition\"] = (\n        f'attachment; filename=\"Integreat_{request.region}_feedback.{file_format}'\n    )\n    return response\n", "path": "integreat_cms/cms/views/feedback/region_feedback_actions.py"}]}