prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  preview in text commenting does not work
  URL: https://meinberlin-dev.liqd.net/dashboard/projects/textkommentierung/basic/
  user: initiator
  expected behaviour: should be able to see preview
  behaviour: get 405 error
  Comment/Question: I checked brainstorming and it works. After I enter content for the document it also works, so I guess it has to do with the module text commenting. We also have the problem on prod, so I guess we need a hot fix.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `meinberlin/apps/documents/views.py`
  Content:
  ```
  1 from django.http import Http404
  2 from django.urls import reverse
  3 from django.utils.functional import cached_property
  4 from django.utils.translation import ugettext_lazy as _
  5 from django.views import generic
  6 
  7 from adhocracy4.dashboard import mixins as dashboard_mixins
  8 from adhocracy4.projects.mixins import DisplayProjectOrModuleMixin
  9 from adhocracy4.projects.mixins import ProjectMixin
  10 from adhocracy4.rules import mixins as rules_mixins
  11 from meinberlin.apps.exports.views import DashboardExportView
  12 
  13 from . import models
  14 
  15 
  16 class DocumentDashboardView(ProjectMixin,
  17                             dashboard_mixins.DashboardBaseMixin,
  18                             dashboard_mixins.DashboardComponentMixin,
  19                             generic.TemplateView):
  20     template_name = 'meinberlin_documents/document_dashboard.html'
  21     permission_required = 'a4projects.change_project'
  22 
  23     def get_permission_object(self):
  24         return self.project
  25 
  26 
  27 class ChapterDetailView(ProjectMixin,
  28                         rules_mixins.PermissionRequiredMixin,
  29                         generic.DetailView,
  30                         DisplayProjectOrModuleMixin):
  31     model = models.Chapter
  32     permission_required = 'meinberlin_documents.view_chapter'
  33     get_context_from_object = True
  34 
  35     def get_context_data(self, **kwargs):
  36         context = super().get_context_data(**kwargs)
  37         context['chapter_list'] = self.chapter_list
  38         return context
  39 
  40     @property
  41     def chapter_list(self):
  42         return models.Chapter.objects.filter(module=self.module)
  43 
  44     @cached_property
  45     def extends(self):
  46         if self.url_name == 'module-detail':
  47             return 'a4modules/module_detail.html'
  48         if self.url_name == 'chapter-detail':
  49             if self.module.is_in_module_cluster:
  50                 return 'a4modules/module_detail.html'
  51         return 'a4projects/project_detail.html'
  52 
  53 
  54 class DocumentDetailView(ChapterDetailView):
  55     get_context_from_object = False
  56 
  57     def get_object(self):
  58         first_chapter = models.Chapter.objects \
  59             .filter(module=self.module) \
  60             .first()
  61 
  62         if not first_chapter:
  63             raise Http404(_('Document has no chapters defined.'))
  64         return first_chapter
  65 
  66 
  67 class ParagraphDetailView(ProjectMixin,
  68                           rules_mixins.PermissionRequiredMixin,
  69                           generic.DetailView):
  70     model = models.Paragraph
  71     permission_required = 'meinberlin_documents.view_paragraph'
  72 
  73 
  74 class DocumentDashboardExportView(DashboardExportView):
  75     template_name = 'meinberlin_exports/export_dashboard.html'
  76 
  77     def get_context_data(self, **kwargs):
  78         context = super().get_context_data(**kwargs)
  79         context['comment_export'] = reverse(
  80             'a4dashboard:document-comment-export',
  81             kwargs={'module_slug': self.module.slug})
  82         return context
  83
  ```
  --- 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/meinberlin/apps/documents/views.py b/meinberlin/apps/documents/views.py
  --- a/meinberlin/apps/documents/views.py
  +++ b/meinberlin/apps/documents/views.py
  @@ -1,7 +1,5 @@
  -from django.http import Http404
   from django.urls import reverse
   from django.utils.functional import cached_property
  -from django.utils.translation import ugettext_lazy as _
   from django.views import generic
   
   from adhocracy4.dashboard import mixins as dashboard_mixins
  @@ -58,9 +56,6 @@
           first_chapter = models.Chapter.objects \
               .filter(module=self.module) \
               .first()
  -
  -        if not first_chapter:
  -            raise Http404(_('Document has no chapters defined.'))
           return first_chapter
  
verification_info: {"golden_diff": "diff --git a/meinberlin/apps/documents/views.py b/meinberlin/apps/documents/views.py\n--- a/meinberlin/apps/documents/views.py\n+++ b/meinberlin/apps/documents/views.py\n@@ -1,7 +1,5 @@\n-from django.http import Http404\n from django.urls import reverse\n from django.utils.functional import cached_property\n-from django.utils.translation import ugettext_lazy as _\n from django.views import generic\n \n from adhocracy4.dashboard import mixins as dashboard_mixins\n@@ -58,9 +56,6 @@\n         first_chapter = models.Chapter.objects \\\n             .filter(module=self.module) \\\n             .first()\n-\n-        if not first_chapter:\n-            raise Http404(_('Document has no chapters defined.'))\n         return first_chapter\n", "issue": "preview in text commenting does not work\nURL: https://meinberlin-dev.liqd.net/dashboard/projects/textkommentierung/basic/\r\nuser: initiator\r\nexpected behaviour: should be able to see preview\r\nbehaviour: get 405 error\r\nComment/Question: I checked brainstorming and it works. After I enter content for the document it also works, so I guess it has to do with the module text commenting. We also have the problem on prod, so I guess we need a hot fix.\n", "before_files": [{"content": "from django.http import Http404\nfrom django.urls import reverse\nfrom django.utils.functional import cached_property\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\n\nfrom adhocracy4.dashboard import mixins as dashboard_mixins\nfrom adhocracy4.projects.mixins import DisplayProjectOrModuleMixin\nfrom adhocracy4.projects.mixins import ProjectMixin\nfrom adhocracy4.rules import mixins as rules_mixins\nfrom meinberlin.apps.exports.views import DashboardExportView\n\nfrom . import models\n\n\nclass DocumentDashboardView(ProjectMixin,\n                            dashboard_mixins.DashboardBaseMixin,\n                            dashboard_mixins.DashboardComponentMixin,\n                            generic.TemplateView):\n    template_name = 'meinberlin_documents/document_dashboard.html'\n    permission_required = 'a4projects.change_project'\n\n    def get_permission_object(self):\n        return self.project\n\n\nclass ChapterDetailView(ProjectMixin,\n                        rules_mixins.PermissionRequiredMixin,\n                        generic.DetailView,\n                        DisplayProjectOrModuleMixin):\n    model = models.Chapter\n    permission_required = 'meinberlin_documents.view_chapter'\n    get_context_from_object = True\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['chapter_list'] = self.chapter_list\n        return context\n\n    @property\n    def chapter_list(self):\n        return models.Chapter.objects.filter(module=self.module)\n\n    @cached_property\n    def extends(self):\n        if self.url_name == 'module-detail':\n            return 'a4modules/module_detail.html'\n        if self.url_name == 'chapter-detail':\n            if self.module.is_in_module_cluster:\n                return 'a4modules/module_detail.html'\n        return 'a4projects/project_detail.html'\n\n\nclass DocumentDetailView(ChapterDetailView):\n    get_context_from_object = False\n\n    def get_object(self):\n        first_chapter = models.Chapter.objects \\\n            .filter(module=self.module) \\\n            .first()\n\n        if not first_chapter:\n            raise Http404(_('Document has no chapters defined.'))\n        return first_chapter\n\n\nclass ParagraphDetailView(ProjectMixin,\n                          rules_mixins.PermissionRequiredMixin,\n                          generic.DetailView):\n    model = models.Paragraph\n    permission_required = 'meinberlin_documents.view_paragraph'\n\n\nclass DocumentDashboardExportView(DashboardExportView):\n    template_name = 'meinberlin_exports/export_dashboard.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['comment_export'] = reverse(\n            'a4dashboard:document-comment-export',\n            kwargs={'module_slug': self.module.slug})\n        return context\n", "path": "meinberlin/apps/documents/views.py"}], "after_files": [{"content": "from django.urls import reverse\nfrom django.utils.functional import cached_property\nfrom django.views import generic\n\nfrom adhocracy4.dashboard import mixins as dashboard_mixins\nfrom adhocracy4.projects.mixins import DisplayProjectOrModuleMixin\nfrom adhocracy4.projects.mixins import ProjectMixin\nfrom adhocracy4.rules import mixins as rules_mixins\nfrom meinberlin.apps.exports.views import DashboardExportView\n\nfrom . import models\n\n\nclass DocumentDashboardView(ProjectMixin,\n                            dashboard_mixins.DashboardBaseMixin,\n                            dashboard_mixins.DashboardComponentMixin,\n                            generic.TemplateView):\n    template_name = 'meinberlin_documents/document_dashboard.html'\n    permission_required = 'a4projects.change_project'\n\n    def get_permission_object(self):\n        return self.project\n\n\nclass ChapterDetailView(ProjectMixin,\n                        rules_mixins.PermissionRequiredMixin,\n                        generic.DetailView,\n                        DisplayProjectOrModuleMixin):\n    model = models.Chapter\n    permission_required = 'meinberlin_documents.view_chapter'\n    get_context_from_object = True\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['chapter_list'] = self.chapter_list\n        return context\n\n    @property\n    def chapter_list(self):\n        return models.Chapter.objects.filter(module=self.module)\n\n    @cached_property\n    def extends(self):\n        if self.url_name == 'module-detail':\n            return 'a4modules/module_detail.html'\n        if self.url_name == 'chapter-detail':\n            if self.module.is_in_module_cluster:\n                return 'a4modules/module_detail.html'\n        return 'a4projects/project_detail.html'\n\n\nclass DocumentDetailView(ChapterDetailView):\n    get_context_from_object = False\n\n    def get_object(self):\n        first_chapter = models.Chapter.objects \\\n            .filter(module=self.module) \\\n            .first()\n        return first_chapter\n\n\nclass ParagraphDetailView(ProjectMixin,\n                          rules_mixins.PermissionRequiredMixin,\n                          generic.DetailView):\n    model = models.Paragraph\n    permission_required = 'meinberlin_documents.view_paragraph'\n\n\nclass DocumentDashboardExportView(DashboardExportView):\n    template_name = 'meinberlin_exports/export_dashboard.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['comment_export'] = reverse(\n            'a4dashboard:document-comment-export',\n            kwargs={'module_slug': self.module.slug})\n        return context\n", "path": "meinberlin/apps/documents/views.py"}]}