We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Type Error in plans list
if a project connected to the plans list adds a module, but no phase dates, the date might become none and the whole list will not be shown

--- 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/plans/views.py`
Content:
```
1 import json
2 
3 from django.conf import settings
4 from django.contrib import messages
5 from django.core.exceptions import ObjectDoesNotExist
6 from django.urls import reverse
7 from django.utils import timezone
8 from django.utils.translation import ugettext
9 from django.utils.translation import ugettext_lazy as _
10 from django.views import generic
11 
12 from adhocracy4.dashboard import mixins as a4dashboard_mixins
13 from adhocracy4.exports import mixins as export_mixins
14 from adhocracy4.exports import unescape_and_strip_html
15 from adhocracy4.exports import views as export_views
16 from adhocracy4.rules import mixins as rules_mixins
17 from meinberlin.apps.contrib.views import CanonicalURLDetailView
18 from meinberlin.apps.maps.models import MapPreset
19 from meinberlin.apps.plans.forms import PlanForm
20 from meinberlin.apps.plans.models import Plan
21 
22 from . import models
23 
24 
25 class PlanDetailView(rules_mixins.PermissionRequiredMixin,
26                      CanonicalURLDetailView):
27     model = models.Plan
28     template_name = 'meinberlin_plans/plan_detail.html'
29     permission_required = 'meinberlin_plans.view_plan'
30 
31     def get_context_data(self, **kwargs):
32         context = super().get_context_data(**kwargs)
33         context['berlin_polygon'] = settings.BERLIN_POLYGON
34         return context
35 
36 
37 class PlanListView(rules_mixins.PermissionRequiredMixin,
38                    generic.ListView):
39     model = models.Plan
40     template_name = 'meinberlin_plans/plan_list.html'
41     permission_required = 'meinberlin_plans.list_plan'
42 
43     def get_districts(self):
44         try:
45             return MapPreset.objects.filter(
46                 category__name='Bezirke - Berlin')
47         except ObjectDoesNotExist:
48             return []
49 
50     def _get_status_string(self, projects):
51 
52         future_phase = None
53         for project in projects:
54             phases = project.phases
55             if phases.active_phases():
56                 return ugettext('running')
57             if phases.future_phases():
58                 date = phases.future_phases().first().start_date
59                 if not future_phase:
60                     future_phase = date
61                 else:
62                     if date < future_phase:
63                         future_phase = date
64 
65         if future_phase:
66             return ugettext('starts at {}').format(future_phase.date())
67 
68     def _get_participation_status(self, item):
69         projects = item.projects.all()\
70             .filter(is_draft=False,
71                     is_archived=False,
72                     is_public=True)
73         if not projects:
74             return item.get_participation_display(), False
75         else:
76             status_string = self._get_status_string(projects)
77             if status_string:
78                 return status_string, True
79             else:
80                 return item.get_participation_display(), False
81 
82     def get_context_data(self, **kwargs):
83         context = super().get_context_data(**kwargs)
84 
85         districts = self.get_districts()
86 
87         district_list = json.dumps([district.polygon
88                                     for district in districts])
89         district_names = json.dumps([district.name
90                                      for district in districts])
91         context['districts'] = district_list
92         context['district_names'] = district_names
93 
94         items = sorted(context['object_list'],
95                        key=lambda x: x.modified or x.created,
96                        reverse=True)
97 
98         result = []
99 
100         for item in items:
101             participation_string, active = self._get_participation_status(item)
102             result.append({
103                 'title': item.title,
104                 'url': item.get_absolute_url(),
105                 'organisation': item.organisation.name,
106                 'point': item.point,
107                 'point_label': item.point_label,
108                 'cost': item.cost,
109                 'district': item.district.name,
110                 'category': item.category,
111                 'status': item.status,
112                 'status_display': item.get_status_display(),
113                 'participation_string': participation_string,
114                 'participation_active': active,
115                 'participation': item.participation,
116                 'participation_display': item.get_participation_display(),
117             })
118 
119         context['items'] = json.dumps(result)
120         context['baseurl'] = settings.A4_MAP_BASEURL
121         context['attribution'] = settings.A4_MAP_ATTRIBUTION
122         context['bounds'] = json.dumps(settings.A4_MAP_BOUNDING_BOX)
123 
124         return context
125 
126 
127 class PlanExportView(rules_mixins.PermissionRequiredMixin,
128                      export_mixins.ItemExportWithLinkMixin,
129                      export_mixins.ExportModelFieldsMixin,
130                      export_mixins.ItemExportWithLocationMixin,
131                      export_views.BaseExport,
132                      export_views.AbstractXlsxExportView):
133 
134     permission_required = 'meinberlin_plans.list_plan'
135     model = models.Plan
136     fields = ['title', 'organisation', 'contact', 'district', 'cost',
137               'description', 'category', 'status', 'participation']
138     html_fields = ['description']
139 
140     def get_object_list(self):
141         return models.Plan.objects.all()
142 
143     def get_base_filename(self):
144         return 'plans_%s' % timezone.now().strftime('%Y%m%dT%H%M%S')
145 
146     def get_virtual_fields(self, virtual):
147         virtual = super().get_virtual_fields(virtual)
148         virtual['projects'] = ugettext('Projects')
149         virtual['projects_links'] = ugettext('Project Links')
150         return virtual
151 
152     def get_organisation_data(self, item):
153         return item.organisation.name
154 
155     def get_district_data(self, item):
156         return item.district.name
157 
158     def get_contact_data(self, item):
159         return unescape_and_strip_html(item.contact)
160 
161     def get_status_data(self, item):
162         return item.get_status_display()
163 
164     def get_participation_data(self, item):
165         return item.get_participation_display()
166 
167     def get_description_data(self, item):
168         return unescape_and_strip_html(item.description)
169 
170     def get_projects_data(self, item):
171         if item.projects.all():
172             return ', \n'.join(
173                 [project.name
174                  for project in item.projects.all()]
175             )
176         return ''
177 
178     def get_projects_links_data(self, item):
179         if item.projects.all():
180             return str([self.request.build_absolute_uri(
181                         project.get_absolute_url())
182                         for project in item.projects.all()
183                         ])
184         return ''
185 
186 
187 class DashboardPlanListView(a4dashboard_mixins.DashboardBaseMixin,
188                             generic.ListView):
189     model = Plan
190     template_name = 'meinberlin_plans/plan_dashboard_list.html'
191     permission_required = 'meinberlin_plans.add_plan'
192     menu_item = 'project'
193 
194     def get_permission_object(self):
195         return self.organisation
196 
197     def get_queryset(self):
198         return super().get_queryset().filter(organisation=self.organisation)
199 
200 
201 class DashboardPlanCreateView(a4dashboard_mixins.DashboardBaseMixin,
202                               generic.CreateView):
203     model = Plan
204     form_class = PlanForm
205     permission_required = 'meinberlin_plans.add_plan'
206     template_name = 'meinberlin_plans/plan_create_form.html'
207     menu_item = 'project'
208 
209     def form_valid(self, form):
210         form.instance.creator = self.request.user
211         form.instance.organisation = self.organisation
212         return super().form_valid(form)
213 
214     def get_permission_object(self):
215         return self.organisation
216 
217     def get_success_url(self):
218         return reverse(
219             'a4dashboard:plan-list',
220             kwargs={'organisation_slug': self.organisation.slug})
221 
222 
223 class DashboardPlanUpdateView(a4dashboard_mixins.DashboardBaseMixin,
224                               generic.UpdateView):
225     model = Plan
226     form_class = PlanForm
227     permission_required = 'meinberlin_plans.change_plan'
228     template_name = 'meinberlin_plans/plan_update_form.html'
229     menu_item = 'project'
230 
231     def get_permission_object(self):
232         return self.organisation
233 
234     def get_success_url(self):
235         return reverse(
236             'a4dashboard:plan-list',
237             kwargs={'organisation_slug': self.organisation.slug})
238 
239 
240 class DashboardPlanDeleteView(a4dashboard_mixins.DashboardBaseMixin,
241                               generic.DeleteView):
242     model = Plan
243     success_message = _('The plan has been deleted')
244     permission_required = 'meinberlin_plans.change_plan'
245     template_name = 'meinberlin_plans/plan_confirm_delete.html'
246     menu_item = 'project'
247 
248     def delete(self, request, *args, **kwargs):
249         messages.success(self.request, self.success_message)
250         return super().delete(request, *args, **kwargs)
251 
252     def get_permission_object(self):
253         return self.organisation
254 
255     def get_success_url(self):
256         return reverse(
257             'a4dashboard:plan-list',
258             kwargs={'organisation_slug': self.organisation.slug})
259
```
--- 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/meinberlin/apps/plans/views.py b/meinberlin/apps/plans/views.py
--- a/meinberlin/apps/plans/views.py
+++ b/meinberlin/apps/plans/views.py
@@ -54,7 +54,8 @@
             phases = project.phases
             if phases.active_phases():
                 return ugettext('running')
-            if phases.future_phases():
+            if phases.future_phases() and \
+               phases.future_phases().first().start_date:
                 date = phases.future_phases().first().start_date
                 if not future_phase:
                     future_phase = date

{"golden_diff": "diff --git a/meinberlin/apps/plans/views.py b/meinberlin/apps/plans/views.py\n--- a/meinberlin/apps/plans/views.py\n+++ b/meinberlin/apps/plans/views.py\n@@ -54,7 +54,8 @@\n             phases = project.phases\n             if phases.active_phases():\n                 return ugettext('running')\n-            if phases.future_phases():\n+            if phases.future_phases() and \\\n+               phases.future_phases().first().start_date:\n                 date = phases.future_phases().first().start_date\n                 if not future_phase:\n                     future_phase = date\n", "issue": "Type Error in plans list\nif a project connected to the plans list adds a module, but no phase dates, the date might become none and the whole list will not be shown\n", "before_files": [{"content": "import json\n\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.urls import reverse\nfrom django.utils import timezone\nfrom django.utils.translation import ugettext\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\n\nfrom adhocracy4.dashboard import mixins as a4dashboard_mixins\nfrom adhocracy4.exports import mixins as export_mixins\nfrom adhocracy4.exports import unescape_and_strip_html\nfrom adhocracy4.exports import views as export_views\nfrom adhocracy4.rules import mixins as rules_mixins\nfrom meinberlin.apps.contrib.views import CanonicalURLDetailView\nfrom meinberlin.apps.maps.models import MapPreset\nfrom meinberlin.apps.plans.forms import PlanForm\nfrom meinberlin.apps.plans.models import Plan\n\nfrom . import models\n\n\nclass PlanDetailView(rules_mixins.PermissionRequiredMixin,\n                     CanonicalURLDetailView):\n    model = models.Plan\n    template_name = 'meinberlin_plans/plan_detail.html'\n    permission_required = 'meinberlin_plans.view_plan'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['berlin_polygon'] = settings.BERLIN_POLYGON\n        return context\n\n\nclass PlanListView(rules_mixins.PermissionRequiredMixin,\n                   generic.ListView):\n    model = models.Plan\n    template_name = 'meinberlin_plans/plan_list.html'\n    permission_required = 'meinberlin_plans.list_plan'\n\n    def get_districts(self):\n        try:\n            return MapPreset.objects.filter(\n                category__name='Bezirke - Berlin')\n        except ObjectDoesNotExist:\n            return []\n\n    def _get_status_string(self, projects):\n\n        future_phase = None\n        for project in projects:\n            phases = project.phases\n            if phases.active_phases():\n                return ugettext('running')\n            if phases.future_phases():\n                date = phases.future_phases().first().start_date\n                if not future_phase:\n                    future_phase = date\n                else:\n                    if date < future_phase:\n                        future_phase = date\n\n        if future_phase:\n            return ugettext('starts at {}').format(future_phase.date())\n\n    def _get_participation_status(self, item):\n        projects = item.projects.all()\\\n            .filter(is_draft=False,\n                    is_archived=False,\n                    is_public=True)\n        if not projects:\n            return item.get_participation_display(), False\n        else:\n            status_string = self._get_status_string(projects)\n            if status_string:\n                return status_string, True\n            else:\n                return item.get_participation_display(), False\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n\n        districts = self.get_districts()\n\n        district_list = json.dumps([district.polygon\n                                    for district in districts])\n        district_names = json.dumps([district.name\n                                     for district in districts])\n        context['districts'] = district_list\n        context['district_names'] = district_names\n\n        items = sorted(context['object_list'],\n                       key=lambda x: x.modified or x.created,\n                       reverse=True)\n\n        result = []\n\n        for item in items:\n            participation_string, active = self._get_participation_status(item)\n            result.append({\n                'title': item.title,\n                'url': item.get_absolute_url(),\n                'organisation': item.organisation.name,\n                'point': item.point,\n                'point_label': item.point_label,\n                'cost': item.cost,\n                'district': item.district.name,\n                'category': item.category,\n                'status': item.status,\n                'status_display': item.get_status_display(),\n                'participation_string': participation_string,\n                'participation_active': active,\n                'participation': item.participation,\n                'participation_display': item.get_participation_display(),\n            })\n\n        context['items'] = json.dumps(result)\n        context['baseurl'] = settings.A4_MAP_BASEURL\n        context['attribution'] = settings.A4_MAP_ATTRIBUTION\n        context['bounds'] = json.dumps(settings.A4_MAP_BOUNDING_BOX)\n\n        return context\n\n\nclass PlanExportView(rules_mixins.PermissionRequiredMixin,\n                     export_mixins.ItemExportWithLinkMixin,\n                     export_mixins.ExportModelFieldsMixin,\n                     export_mixins.ItemExportWithLocationMixin,\n                     export_views.BaseExport,\n                     export_views.AbstractXlsxExportView):\n\n    permission_required = 'meinberlin_plans.list_plan'\n    model = models.Plan\n    fields = ['title', 'organisation', 'contact', 'district', 'cost',\n              'description', 'category', 'status', 'participation']\n    html_fields = ['description']\n\n    def get_object_list(self):\n        return models.Plan.objects.all()\n\n    def get_base_filename(self):\n        return 'plans_%s' % timezone.now().strftime('%Y%m%dT%H%M%S')\n\n    def get_virtual_fields(self, virtual):\n        virtual = super().get_virtual_fields(virtual)\n        virtual['projects'] = ugettext('Projects')\n        virtual['projects_links'] = ugettext('Project Links')\n        return virtual\n\n    def get_organisation_data(self, item):\n        return item.organisation.name\n\n    def get_district_data(self, item):\n        return item.district.name\n\n    def get_contact_data(self, item):\n        return unescape_and_strip_html(item.contact)\n\n    def get_status_data(self, item):\n        return item.get_status_display()\n\n    def get_participation_data(self, item):\n        return item.get_participation_display()\n\n    def get_description_data(self, item):\n        return unescape_and_strip_html(item.description)\n\n    def get_projects_data(self, item):\n        if item.projects.all():\n            return ', \\n'.join(\n                [project.name\n                 for project in item.projects.all()]\n            )\n        return ''\n\n    def get_projects_links_data(self, item):\n        if item.projects.all():\n            return str([self.request.build_absolute_uri(\n                        project.get_absolute_url())\n                        for project in item.projects.all()\n                        ])\n        return ''\n\n\nclass DashboardPlanListView(a4dashboard_mixins.DashboardBaseMixin,\n                            generic.ListView):\n    model = Plan\n    template_name = 'meinberlin_plans/plan_dashboard_list.html'\n    permission_required = 'meinberlin_plans.add_plan'\n    menu_item = 'project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_queryset(self):\n        return super().get_queryset().filter(organisation=self.organisation)\n\n\nclass DashboardPlanCreateView(a4dashboard_mixins.DashboardBaseMixin,\n                              generic.CreateView):\n    model = Plan\n    form_class = PlanForm\n    permission_required = 'meinberlin_plans.add_plan'\n    template_name = 'meinberlin_plans/plan_create_form.html'\n    menu_item = 'project'\n\n    def form_valid(self, form):\n        form.instance.creator = self.request.user\n        form.instance.organisation = self.organisation\n        return super().form_valid(form)\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse(\n            'a4dashboard:plan-list',\n            kwargs={'organisation_slug': self.organisation.slug})\n\n\nclass DashboardPlanUpdateView(a4dashboard_mixins.DashboardBaseMixin,\n                              generic.UpdateView):\n    model = Plan\n    form_class = PlanForm\n    permission_required = 'meinberlin_plans.change_plan'\n    template_name = 'meinberlin_plans/plan_update_form.html'\n    menu_item = 'project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse(\n            'a4dashboard:plan-list',\n            kwargs={'organisation_slug': self.organisation.slug})\n\n\nclass DashboardPlanDeleteView(a4dashboard_mixins.DashboardBaseMixin,\n                              generic.DeleteView):\n    model = Plan\n    success_message = _('The plan has been deleted')\n    permission_required = 'meinberlin_plans.change_plan'\n    template_name = 'meinberlin_plans/plan_confirm_delete.html'\n    menu_item = 'project'\n\n    def delete(self, request, *args, **kwargs):\n        messages.success(self.request, self.success_message)\n        return super().delete(request, *args, **kwargs)\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse(\n            'a4dashboard:plan-list',\n            kwargs={'organisation_slug': self.organisation.slug})\n", "path": "meinberlin/apps/plans/views.py"}], "after_files": [{"content": "import json\n\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.urls import reverse\nfrom django.utils import timezone\nfrom django.utils.translation import ugettext\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\n\nfrom adhocracy4.dashboard import mixins as a4dashboard_mixins\nfrom adhocracy4.exports import mixins as export_mixins\nfrom adhocracy4.exports import unescape_and_strip_html\nfrom adhocracy4.exports import views as export_views\nfrom adhocracy4.rules import mixins as rules_mixins\nfrom meinberlin.apps.contrib.views import CanonicalURLDetailView\nfrom meinberlin.apps.maps.models import MapPreset\nfrom meinberlin.apps.plans.forms import PlanForm\nfrom meinberlin.apps.plans.models import Plan\n\nfrom . import models\n\n\nclass PlanDetailView(rules_mixins.PermissionRequiredMixin,\n                     CanonicalURLDetailView):\n    model = models.Plan\n    template_name = 'meinberlin_plans/plan_detail.html'\n    permission_required = 'meinberlin_plans.view_plan'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['berlin_polygon'] = settings.BERLIN_POLYGON\n        return context\n\n\nclass PlanListView(rules_mixins.PermissionRequiredMixin,\n                   generic.ListView):\n    model = models.Plan\n    template_name = 'meinberlin_plans/plan_list.html'\n    permission_required = 'meinberlin_plans.list_plan'\n\n    def get_districts(self):\n        try:\n            return MapPreset.objects.filter(\n                category__name='Bezirke - Berlin')\n        except ObjectDoesNotExist:\n            return []\n\n    def _get_status_string(self, projects):\n\n        future_phase = None\n        for project in projects:\n            phases = project.phases\n            if phases.active_phases():\n                return ugettext('running')\n            if phases.future_phases() and \\\n               phases.future_phases().first().start_date:\n                date = phases.future_phases().first().start_date\n                if not future_phase:\n                    future_phase = date\n                else:\n                    if date < future_phase:\n                        future_phase = date\n\n        if future_phase:\n            return ugettext('starts at {}').format(future_phase.date())\n\n    def _get_participation_status(self, item):\n        projects = item.projects.all()\\\n            .filter(is_draft=False,\n                    is_archived=False,\n                    is_public=True)\n        if not projects:\n            return item.get_participation_display(), False\n        else:\n            status_string = self._get_status_string(projects)\n            if status_string:\n                return status_string, True\n            else:\n                return item.get_participation_display(), False\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n\n        districts = self.get_districts()\n\n        district_list = json.dumps([district.polygon\n                                    for district in districts])\n        district_names = json.dumps([district.name\n                                     for district in districts])\n        context['districts'] = district_list\n        context['district_names'] = district_names\n\n        items = sorted(context['object_list'],\n                       key=lambda x: x.modified or x.created,\n                       reverse=True)\n\n        result = []\n\n        for item in items:\n            participation_string, active = self._get_participation_status(item)\n            result.append({\n                'title': item.title,\n                'url': item.get_absolute_url(),\n                'organisation': item.organisation.name,\n                'point': item.point,\n                'point_label': item.point_label,\n                'cost': item.cost,\n                'district': item.district.name,\n                'category': item.category,\n                'status': item.status,\n                'status_display': item.get_status_display(),\n                'participation_string': participation_string,\n                'participation_active': active,\n                'participation': item.participation,\n                'participation_display': item.get_participation_display(),\n            })\n\n        context['items'] = json.dumps(result)\n        context['baseurl'] = settings.A4_MAP_BASEURL\n        context['attribution'] = settings.A4_MAP_ATTRIBUTION\n        context['bounds'] = json.dumps(settings.A4_MAP_BOUNDING_BOX)\n\n        return context\n\n\nclass PlanExportView(rules_mixins.PermissionRequiredMixin,\n                     export_mixins.ItemExportWithLinkMixin,\n                     export_mixins.ExportModelFieldsMixin,\n                     export_mixins.ItemExportWithLocationMixin,\n                     export_views.BaseExport,\n                     export_views.AbstractXlsxExportView):\n\n    permission_required = 'meinberlin_plans.list_plan'\n    model = models.Plan\n    fields = ['title', 'organisation', 'contact', 'district', 'cost',\n              'description', 'category', 'status', 'participation']\n    html_fields = ['description']\n\n    def get_object_list(self):\n        return models.Plan.objects.all()\n\n    def get_base_filename(self):\n        return 'plans_%s' % timezone.now().strftime('%Y%m%dT%H%M%S')\n\n    def get_virtual_fields(self, virtual):\n        virtual = super().get_virtual_fields(virtual)\n        virtual['projects'] = ugettext('Projects')\n        virtual['projects_links'] = ugettext('Project Links')\n        return virtual\n\n    def get_organisation_data(self, item):\n        return item.organisation.name\n\n    def get_district_data(self, item):\n        return item.district.name\n\n    def get_contact_data(self, item):\n        return unescape_and_strip_html(item.contact)\n\n    def get_status_data(self, item):\n        return item.get_status_display()\n\n    def get_participation_data(self, item):\n        return item.get_participation_display()\n\n    def get_description_data(self, item):\n        return unescape_and_strip_html(item.description)\n\n    def get_projects_data(self, item):\n        if item.projects.all():\n            return ', \\n'.join(\n                [project.name\n                 for project in item.projects.all()]\n            )\n        return ''\n\n    def get_projects_links_data(self, item):\n        if item.projects.all():\n            return str([self.request.build_absolute_uri(\n                        project.get_absolute_url())\n                        for project in item.projects.all()\n                        ])\n        return ''\n\n\nclass DashboardPlanListView(a4dashboard_mixins.DashboardBaseMixin,\n                            generic.ListView):\n    model = Plan\n    template_name = 'meinberlin_plans/plan_dashboard_list.html'\n    permission_required = 'meinberlin_plans.add_plan'\n    menu_item = 'project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_queryset(self):\n        return super().get_queryset().filter(organisation=self.organisation)\n\n\nclass DashboardPlanCreateView(a4dashboard_mixins.DashboardBaseMixin,\n                              generic.CreateView):\n    model = Plan\n    form_class = PlanForm\n    permission_required = 'meinberlin_plans.add_plan'\n    template_name = 'meinberlin_plans/plan_create_form.html'\n    menu_item = 'project'\n\n    def form_valid(self, form):\n        form.instance.creator = self.request.user\n        form.instance.organisation = self.organisation\n        return super().form_valid(form)\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse(\n            'a4dashboard:plan-list',\n            kwargs={'organisation_slug': self.organisation.slug})\n\n\nclass DashboardPlanUpdateView(a4dashboard_mixins.DashboardBaseMixin,\n                              generic.UpdateView):\n    model = Plan\n    form_class = PlanForm\n    permission_required = 'meinberlin_plans.change_plan'\n    template_name = 'meinberlin_plans/plan_update_form.html'\n    menu_item = 'project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse(\n            'a4dashboard:plan-list',\n            kwargs={'organisation_slug': self.organisation.slug})\n\n\nclass DashboardPlanDeleteView(a4dashboard_mixins.DashboardBaseMixin,\n                              generic.DeleteView):\n    model = Plan\n    success_message = _('The plan has been deleted')\n    permission_required = 'meinberlin_plans.change_plan'\n    template_name = 'meinberlin_plans/plan_confirm_delete.html'\n    menu_item = 'project'\n\n    def delete(self, request, *args, **kwargs):\n        messages.success(self.request, self.success_message)\n        return super().delete(request, *args, **kwargs)\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse(\n            'a4dashboard:plan-list',\n            kwargs={'organisation_slug': self.organisation.slug})\n", "path": "meinberlin/apps/plans/views.py"}]}