prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  text commenting results show module detail 
  when only text commenting module used for project, module detail also shown in results tab
  
  </issue>
  <code>
  [start of meinberlin/apps/documents/views.py]
  1 from django.http import Http404
  2 from django.http.response import HttpResponseRedirect
  3 from django.urls import reverse
  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 ProjectMixin
  9 from adhocracy4.rules import mixins as rules_mixins
  10 from meinberlin.apps.contrib import mixins as contrib_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                         contrib_mixins.DisplayProjectOrModuleMixin):
  31     model = models.Chapter
  32     permission_required = 'meinberlin_documents.view_chapter'
  33     get_context_from_object = True
  34 
  35     def dispatch(self, request, *args, **kwargs):
  36         # Redirect first chapter view to the project detail page
  37         res = super().dispatch(request, *args, **kwargs)
  38         chapter = self.get_object()
  39         if self.request.path == chapter.get_absolute_url() \
  40                 and chapter == self.chapter_list.first():
  41             return HttpResponseRedirect(self.project.get_absolute_url())
  42         else:
  43             return res
  44 
  45     def get_context_data(self, **kwargs):
  46         context = super(ChapterDetailView, self).get_context_data(**kwargs)
  47         context['chapter_list'] = self.chapter_list
  48         return context
  49 
  50     @property
  51     def chapter_list(self):
  52         return models.Chapter.objects.filter(module=self.module)
  53 
  54 
  55 class DocumentDetailView(ChapterDetailView):
  56     get_context_from_object = False
  57 
  58     def get_object(self):
  59         first_chapter = models.Chapter.objects \
  60             .filter(module=self.module) \
  61             .first()
  62 
  63         if not first_chapter:
  64             raise Http404(_('Document has no chapters defined.'))
  65         return first_chapter
  66 
  67 
  68 class ParagraphDetailView(ProjectMixin,
  69                           rules_mixins.PermissionRequiredMixin,
  70                           generic.DetailView):
  71     model = models.Paragraph
  72     permission_required = 'meinberlin_documents.view_paragraph'
  73 
  74 
  75 class DocumentDashboardExportView(DashboardExportView):
  76     template_name = 'meinberlin_exports/export_dashboard.html'
  77 
  78     def get_context_data(self, **kwargs):
  79         context = super().get_context_data(**kwargs)
  80         context['comment_export'] = reverse(
  81             'a4dashboard:document-comment-export',
  82             kwargs={'module_slug': self.module.slug})
  83         return context
  84
  [end of meinberlin/apps/documents/views.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
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,5 +1,4 @@
   from django.http import Http404
  -from django.http.response import HttpResponseRedirect
   from django.urls import reverse
   from django.utils.translation import ugettext_lazy as _
   from django.views import generic
  @@ -32,16 +31,6 @@
       permission_required = 'meinberlin_documents.view_chapter'
       get_context_from_object = True
   
  -    def dispatch(self, request, *args, **kwargs):
  -        # Redirect first chapter view to the project detail page
  -        res = super().dispatch(request, *args, **kwargs)
  -        chapter = self.get_object()
  -        if self.request.path == chapter.get_absolute_url() \
  -                and chapter == self.chapter_list.first():
  -            return HttpResponseRedirect(self.project.get_absolute_url())
  -        else:
  -            return res
  -
       def get_context_data(self, **kwargs):
           context = super(ChapterDetailView, self).get_context_data(**kwargs)
           context['chapter_list'] = self.chapter_list
  
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,5 +1,4 @@\n from django.http import Http404\n-from django.http.response import HttpResponseRedirect\n from django.urls import reverse\n from django.utils.translation import ugettext_lazy as _\n from django.views import generic\n@@ -32,16 +31,6 @@\n     permission_required = 'meinberlin_documents.view_chapter'\n     get_context_from_object = True\n \n-    def dispatch(self, request, *args, **kwargs):\n-        # Redirect first chapter view to the project detail page\n-        res = super().dispatch(request, *args, **kwargs)\n-        chapter = self.get_object()\n-        if self.request.path == chapter.get_absolute_url() \\\n-                and chapter == self.chapter_list.first():\n-            return HttpResponseRedirect(self.project.get_absolute_url())\n-        else:\n-            return res\n-\n     def get_context_data(self, **kwargs):\n         context = super(ChapterDetailView, self).get_context_data(**kwargs)\n         context['chapter_list'] = self.chapter_list\n", "issue": "text commenting results show module detail \nwhen only text commenting module used for project, module detail also shown in results tab\n", "before_files": [{"content": "from django.http import Http404\nfrom django.http.response import HttpResponseRedirect\nfrom django.urls import reverse\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 ProjectMixin\nfrom adhocracy4.rules import mixins as rules_mixins\nfrom meinberlin.apps.contrib import mixins as contrib_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                        contrib_mixins.DisplayProjectOrModuleMixin):\n    model = models.Chapter\n    permission_required = 'meinberlin_documents.view_chapter'\n    get_context_from_object = True\n\n    def dispatch(self, request, *args, **kwargs):\n        # Redirect first chapter view to the project detail page\n        res = super().dispatch(request, *args, **kwargs)\n        chapter = self.get_object()\n        if self.request.path == chapter.get_absolute_url() \\\n                and chapter == self.chapter_list.first():\n            return HttpResponseRedirect(self.project.get_absolute_url())\n        else:\n            return res\n\n    def get_context_data(self, **kwargs):\n        context = super(ChapterDetailView, self).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\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"}]}