We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
testing 2769 status guide
**URL:** dashboard
**user:** initiator
**expected behaviour:** space between line and dots of the status guide is always the same
**behaviour:** if wording is in two lines, the space between line and dot gets bigger
**important screensize:** depending on screensize, e.g. 1020x723
**device & browser:** all browsers
**Comment/Question:** 

Screenshot
<img width="203" alt="Bildschirmfoto 2020-03-29 um 21 45 11" src="https://user-images.githubusercontent.com/35491681/77876518-7b9d9b80-7253-11ea-8d7c-2b0fc1681e02.png">



--- 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/bplan/views.py`
Content:
```
1 from django.utils.translation import ugettext_lazy as _
2 from django.views import generic
3 from django.views.generic import TemplateView
4 
5 from adhocracy4.dashboard.blueprints import ProjectBlueprint
6 from adhocracy4.dashboard.components.forms.views import \
7     ProjectComponentFormView
8 from adhocracy4.dashboard.mixins import DashboardBaseMixin
9 from meinberlin.apps.bplan import phases as bplan_phases
10 from meinberlin.apps.extprojects.views import ExternalProjectCreateView
11 
12 from . import forms
13 from . import models
14 
15 
16 class BplanStatementSentView(TemplateView):
17     template_name = 'meinberlin_bplan/statement_sent.html'
18 
19 
20 class BplanFinishedView(TemplateView):
21     template_name = 'meinberlin_bplan/bplan_finished.html'
22 
23 
24 class BplanProjectCreateView(ExternalProjectCreateView):
25 
26     model = models.Bplan
27     slug_url_kwarg = 'project_slug'
28     form_class = forms.BplanProjectCreateForm
29     template_name = \
30         'meinberlin_bplan/bplan_create_dashboard.html'
31     success_message = _('Development plan successfully created.')
32 
33     blueprint = ProjectBlueprint(
34         title=_('Development Plan'),
35         description=_('Create a statement formular for development plans'
36                       ' to be embedded on external sites.'),
37         content=[
38             bplan_phases.StatementPhase(),
39         ],
40         image='',
41         settings_model=None,
42     )
43 
44 
45 class BplanProjectUpdateView(ProjectComponentFormView):
46 
47     model = models.Bplan
48 
49     @property
50     def project(self):
51         project = super().project
52         return project.externalproject.bplan
53 
54     def get_object(self, queryset=None):
55         return self.project
56 
57 
58 class BplanProjectListView(DashboardBaseMixin,
59                            generic.ListView):
60     model = models.Bplan
61     paginate_by = 12
62     template_name = 'meinberlin_bplan/bplan_list_dashboard.html'
63     permission_required = 'a4projects.add_project'
64     menu_item = 'project'
65 
66     def get_queryset(self):
67         return super().get_queryset().filter(
68             organisation=self.organisation
69         )
70 
71     def get_permission_object(self):
72         return self.organisation
73
```

Path: `meinberlin/apps/dashboard/views.py`
Content:
```
1 import json
2 from urllib import parse
3 
4 from django.apps import apps
5 from django.contrib import messages
6 from django.contrib.messages.views import SuccessMessageMixin
7 from django.http import HttpResponseRedirect
8 from django.urls import resolve
9 from django.urls import reverse
10 from django.utils.translation import ugettext_lazy as _
11 from django.views import generic
12 from django.views.generic.detail import SingleObjectMixin
13 
14 from adhocracy4.dashboard import mixins
15 from adhocracy4.dashboard import signals
16 from adhocracy4.dashboard import views as a4dashboard_views
17 from adhocracy4.dashboard.blueprints import get_blueprints
18 from adhocracy4.modules import models as module_models
19 from adhocracy4.phases import models as phase_models
20 from adhocracy4.projects import models as project_models
21 from adhocracy4.projects.mixins import ProjectMixin
22 from meinberlin.apps.dashboard.forms import DashboardProjectCreateForm
23 
24 
25 class ModuleBlueprintListView(ProjectMixin,
26                               mixins.DashboardBaseMixin,
27                               mixins.BlueprintMixin,
28                               generic.DetailView):
29     template_name = 'meinberlin_dashboard/module_blueprint_list_dashboard.html'
30     permission_required = 'a4projects.change_project'
31     model = project_models.Project
32     slug_url_kwarg = 'project_slug'
33     menu_item = 'project'
34 
35     @property
36     def blueprints(self):
37         return get_blueprints()
38 
39     def get_permission_object(self):
40         return self.project
41 
42 
43 class ModuleCreateView(ProjectMixin,
44                        mixins.DashboardBaseMixin,
45                        mixins.BlueprintMixin,
46                        SingleObjectMixin,
47                        generic.View):
48     permission_required = 'a4projects.change_project'
49     model = project_models.Project
50     slug_url_kwarg = 'project_slug'
51 
52     def post(self, request, *args, **kwargs):
53         project = self.get_object()
54         weight = 1
55         if project.modules:
56             weight = max(
57                 project.modules.values_list('weight', flat=True)
58             ) + 1
59         module = module_models.Module(
60             name=self.blueprint.title,
61             weight=weight,
62             project=project,
63             is_draft=True,
64         )
65         module.save()
66         signals.module_created.send(sender=None,
67                                     module=module,
68                                     user=self.request.user)
69 
70         self._create_module_settings(module)
71         self._create_phases(module, self.blueprint.content)
72 
73         cookie = request.COOKIES.get('dashboard_projects_closed_accordeons',
74                                      '[]')
75         ids = json.loads(parse.unquote(cookie))
76         if self.project.id not in ids:
77             ids.append(self.project.id)
78 
79         cookie = parse.quote(json.dumps(ids))
80 
81         response = HttpResponseRedirect(self.get_next(module))
82         response.set_cookie('dashboard_projects_closed_accordeons', cookie)
83         return response
84 
85     def _create_module_settings(self, module):
86         if self.blueprint.settings_model:
87             settings_model = apps.get_model(*self.blueprint.settings_model)
88             module_settings = settings_model(module=module)
89             module_settings.save()
90 
91     def _create_phases(self, module, blueprint_phases):
92         for index, phase_content in enumerate(blueprint_phases):
93             phase = phase_models.Phase(
94                 type=phase_content.identifier,
95                 name=phase_content.name,
96                 description=phase_content.description,
97                 weight=index,
98                 module=module,
99             )
100             phase.save()
101 
102     def get_next(self, module):
103         return reverse('a4dashboard:dashboard-module_basic-edit', kwargs={
104             'module_slug': module.slug
105         })
106 
107     def get_permission_object(self):
108         return self.project
109 
110 
111 class ModulePublishView(SingleObjectMixin,
112                         generic.View):
113     permission_required = 'a4projects.change_project'
114     model = module_models.Module
115     slug_url_kwarg = 'module_slug'
116 
117     def get_permission_object(self):
118         return self.get_object().project
119 
120     def post(self, request, *args, **kwargs):
121         action = request.POST.get('action', None)
122         if action == 'publish':
123             self.publish_module()
124         elif action == 'unpublish':
125             self.unpublish_module()
126         else:
127             messages.warning(self.request, _('Invalid action'))
128 
129         return HttpResponseRedirect(self.get_next())
130 
131     def get_next(self):
132         if 'referrer' in self.request.POST:
133             return self.request.POST['referrer']
134         elif 'HTTP_REFERER' in self.request.META:
135             return self.request.META['HTTP_REFERER']
136 
137         return reverse('a4dashboard:project-edit', kwargs={
138             'project_slug': self.project.slug
139         })
140 
141     def publish_module(self):
142         module = self.get_object()
143         if not module.is_draft:
144             messages.info(self.request, _('Module is already added'))
145             return
146 
147         module.is_draft = False
148         module.save()
149 
150         signals.module_published.send(sender=None,
151                                       module=module,
152                                       user=self.request.user)
153 
154         messages.success(self.request,
155                          _('Module successfully added.'))
156 
157     def unpublish_module(self):
158         module = self.get_object()
159         if module.is_draft:
160             messages.info(self.request, _('Module is already removed'))
161             return
162 
163         module.is_draft = True
164         module.save()
165 
166         signals.module_unpublished.send(sender=None,
167                                         module=module,
168                                         user=self.request.user)
169 
170         messages.success(self.request,
171                          _('Module successfully removed.'))
172 
173 
174 class ModuleDeleteView(generic.DeleteView):
175     permission_required = 'a4projects.change_project'
176     model = module_models.Module
177     success_message = _('The module has been deleted')
178 
179     def delete(self, request, *args, **kwargs):
180         messages.success(self.request, self.success_message)
181         return super().delete(request, *args, **kwargs)
182 
183     def get_permission_object(self):
184         return self.get_object().project
185 
186     def get_success_url(self):
187         referrer = self.request.POST.get('referrer', None) \
188             or self.request.META.get('HTTP_REFERER', None)
189         if referrer:
190             view, args, kwargs = resolve(referrer)
191             if 'module_slug' not in kwargs \
192                     or not kwargs['module_slug'] == self.get_object().slug:
193                 return referrer
194 
195         return reverse('a4dashboard:project-edit', kwargs={
196             'project_slug': self.get_object().project.slug
197         })
198 
199 
200 class DashboardProjectListView(a4dashboard_views.ProjectListView):
201     def get_queryset(self):
202         return super().get_queryset().filter(
203             projectcontainer=None,
204             externalproject=None
205         )
206 
207 
208 class ProjectCreateView(mixins.DashboardBaseMixin,
209                         SuccessMessageMixin,
210                         generic.CreateView):
211     model = project_models.Project
212     slug_url_kwarg = 'project_slug'
213     form_class = DashboardProjectCreateForm
214     template_name = 'a4dashboard/project_create_form.html'
215     permission_required = 'a4projects.add_project'
216     menu_item = 'project'
217     success_message = _('Project successfully created.')
218 
219     def get_permission_object(self):
220         return self.organisation
221 
222     def get_form_kwargs(self):
223         kwargs = super().get_form_kwargs()
224         kwargs['organisation'] = self.organisation
225         kwargs['creator'] = self.request.user
226         return kwargs
227 
228     def get_success_url(self):
229         return reverse('a4dashboard:project-edit',
230                        kwargs={'project_slug': self.object.slug})
231 
232     def form_valid(self, form):
233         response = super().form_valid(form)
234         signals.project_created.send(sender=None,
235                                      project=self.object,
236                                      user=self.request.user)
237 
238         return response
239
```

Path: `meinberlin/apps/extprojects/views.py`
Content:
```
1 from django.utils.translation import ugettext_lazy as _
2 from django.views import generic
3 
4 from adhocracy4.dashboard.blueprints import ProjectBlueprint
5 from adhocracy4.dashboard.components.forms.views import \
6     ProjectComponentFormView
7 from adhocracy4.dashboard.mixins import DashboardBaseMixin
8 from adhocracy4.dashboard.views import ProjectCreateView
9 from meinberlin.apps.extprojects import phases as extprojects_phases
10 
11 from . import apps
12 from . import forms
13 from . import models
14 
15 
16 class ExternalProjectCreateView(ProjectCreateView):
17 
18     model = models.ExternalProject
19     slug_url_kwarg = 'project_slug'
20     form_class = forms.ExternalProjectCreateForm
21     template_name = \
22         'meinberlin_extprojects/external_project_create_dashboard.html'
23     success_message = _('External project successfully created.')
24 
25     blueprint = ProjectBlueprint(
26         title=_('Linkage'),
27         description=_(
28             'Linkages are handled on a different platform.'
29         ),
30         content=[
31             extprojects_phases.ExternalPhase(),
32         ],
33         image='',
34         settings_model=None,
35     )
36 
37 
38 class ExternalProjectUpdateView(ProjectComponentFormView):
39 
40     model = models.ExternalProject
41 
42     @property
43     def project(self):
44         project = super().project
45         return project.externalproject
46 
47     def get_object(self, queryset=None):
48         return self.project
49 
50 
51 class ExternalProjectListView(DashboardBaseMixin,
52                               generic.ListView):
53     model = models.ExternalProject
54     paginate_by = 12
55     template_name = 'meinberlin_extprojects/extproject_list_dashboard.html'
56     permission_required = 'a4projects.add_project'
57     menu_item = 'project'
58 
59     def get_queryset(self):
60         project_type = '{}.{}'.format(
61             apps.Config.label,
62             'ExternalProject'
63         )
64         return super().get_queryset().filter(
65             organisation=self.organisation,
66             project_type=project_type
67         )
68 
69     def get_permission_object(self):
70         return self.organisation
71
```
--- 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/bplan/views.py b/meinberlin/apps/bplan/views.py
--- a/meinberlin/apps/bplan/views.py
+++ b/meinberlin/apps/bplan/views.py
@@ -28,7 +28,7 @@
     form_class = forms.BplanProjectCreateForm
     template_name = \
         'meinberlin_bplan/bplan_create_dashboard.html'
-    success_message = _('Development plan successfully created.')
+    success_message = _('Development plan was created.')
 
     blueprint = ProjectBlueprint(
         title=_('Development Plan'),
diff --git a/meinberlin/apps/dashboard/views.py b/meinberlin/apps/dashboard/views.py
--- a/meinberlin/apps/dashboard/views.py
+++ b/meinberlin/apps/dashboard/views.py
@@ -48,6 +48,7 @@
     permission_required = 'a4projects.change_project'
     model = project_models.Project
     slug_url_kwarg = 'project_slug'
+    success_message = _('The module was created')
 
     def post(self, request, *args, **kwargs):
         project = self.get_object()
@@ -69,6 +70,7 @@
 
         self._create_module_settings(module)
         self._create_phases(module, self.blueprint.content)
+        messages.success(self.request, self.success_message)
 
         cookie = request.COOKIES.get('dashboard_projects_closed_accordeons',
                                      '[]')
@@ -152,7 +154,7 @@
                                       user=self.request.user)
 
         messages.success(self.request,
-                         _('Module successfully added.'))
+                         _('The module is displayed in the project.'))
 
     def unpublish_module(self):
         module = self.get_object()
@@ -168,7 +170,8 @@
                                         user=self.request.user)
 
         messages.success(self.request,
-                         _('Module successfully removed.'))
+                         _('The module is no longer displayed in the project.'
+                           ))
 
 
 class ModuleDeleteView(generic.DeleteView):
@@ -214,7 +217,7 @@
     template_name = 'a4dashboard/project_create_form.html'
     permission_required = 'a4projects.add_project'
     menu_item = 'project'
-    success_message = _('Project successfully created.')
+    success_message = _('Project was created.')
 
     def get_permission_object(self):
         return self.organisation
diff --git a/meinberlin/apps/extprojects/views.py b/meinberlin/apps/extprojects/views.py
--- a/meinberlin/apps/extprojects/views.py
+++ b/meinberlin/apps/extprojects/views.py
@@ -20,7 +20,7 @@
     form_class = forms.ExternalProjectCreateForm
     template_name = \
         'meinberlin_extprojects/external_project_create_dashboard.html'
-    success_message = _('External project successfully created.')
+    success_message = _('External project was created.')
 
     blueprint = ProjectBlueprint(
         title=_('Linkage'),

{"golden_diff": "diff --git a/meinberlin/apps/bplan/views.py b/meinberlin/apps/bplan/views.py\n--- a/meinberlin/apps/bplan/views.py\n+++ b/meinberlin/apps/bplan/views.py\n@@ -28,7 +28,7 @@\n     form_class = forms.BplanProjectCreateForm\n     template_name = \\\n         'meinberlin_bplan/bplan_create_dashboard.html'\n-    success_message = _('Development plan successfully created.')\n+    success_message = _('Development plan was created.')\n \n     blueprint = ProjectBlueprint(\n         title=_('Development Plan'),\ndiff --git a/meinberlin/apps/dashboard/views.py b/meinberlin/apps/dashboard/views.py\n--- a/meinberlin/apps/dashboard/views.py\n+++ b/meinberlin/apps/dashboard/views.py\n@@ -48,6 +48,7 @@\n     permission_required = 'a4projects.change_project'\n     model = project_models.Project\n     slug_url_kwarg = 'project_slug'\n+    success_message = _('The module was created')\n \n     def post(self, request, *args, **kwargs):\n         project = self.get_object()\n@@ -69,6 +70,7 @@\n \n         self._create_module_settings(module)\n         self._create_phases(module, self.blueprint.content)\n+        messages.success(self.request, self.success_message)\n \n         cookie = request.COOKIES.get('dashboard_projects_closed_accordeons',\n                                      '[]')\n@@ -152,7 +154,7 @@\n                                       user=self.request.user)\n \n         messages.success(self.request,\n-                         _('Module successfully added.'))\n+                         _('The module is displayed in the project.'))\n \n     def unpublish_module(self):\n         module = self.get_object()\n@@ -168,7 +170,8 @@\n                                         user=self.request.user)\n \n         messages.success(self.request,\n-                         _('Module successfully removed.'))\n+                         _('The module is no longer displayed in the project.'\n+                           ))\n \n \n class ModuleDeleteView(generic.DeleteView):\n@@ -214,7 +217,7 @@\n     template_name = 'a4dashboard/project_create_form.html'\n     permission_required = 'a4projects.add_project'\n     menu_item = 'project'\n-    success_message = _('Project successfully created.')\n+    success_message = _('Project was created.')\n \n     def get_permission_object(self):\n         return self.organisation\ndiff --git a/meinberlin/apps/extprojects/views.py b/meinberlin/apps/extprojects/views.py\n--- a/meinberlin/apps/extprojects/views.py\n+++ b/meinberlin/apps/extprojects/views.py\n@@ -20,7 +20,7 @@\n     form_class = forms.ExternalProjectCreateForm\n     template_name = \\\n         'meinberlin_extprojects/external_project_create_dashboard.html'\n-    success_message = _('External project successfully created.')\n+    success_message = _('External project was created.')\n \n     blueprint = ProjectBlueprint(\n         title=_('Linkage'),\n", "issue": "testing 2769 status guide\n**URL:** dashboard\r\n**user:** initiator\r\n**expected behaviour:** space between line and dots of the status guide is always the same\r\n**behaviour:** if wording is in two lines, the space between line and dot gets bigger\r\n**important screensize:** depending on screensize, e.g. 1020x723\r\n**device & browser:** all browsers\r\n**Comment/Question:** \r\n\r\nScreenshot\r\n<img width=\"203\" alt=\"Bildschirmfoto 2020-03-29 um 21 45 11\" src=\"https://user-images.githubusercontent.com/35491681/77876518-7b9d9b80-7253-11ea-8d7c-2b0fc1681e02.png\">\r\n\r\n\n", "before_files": [{"content": "from django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\nfrom django.views.generic import TemplateView\n\nfrom adhocracy4.dashboard.blueprints import ProjectBlueprint\nfrom adhocracy4.dashboard.components.forms.views import \\\n    ProjectComponentFormView\nfrom adhocracy4.dashboard.mixins import DashboardBaseMixin\nfrom meinberlin.apps.bplan import phases as bplan_phases\nfrom meinberlin.apps.extprojects.views import ExternalProjectCreateView\n\nfrom . import forms\nfrom . import models\n\n\nclass BplanStatementSentView(TemplateView):\n    template_name = 'meinberlin_bplan/statement_sent.html'\n\n\nclass BplanFinishedView(TemplateView):\n    template_name = 'meinberlin_bplan/bplan_finished.html'\n\n\nclass BplanProjectCreateView(ExternalProjectCreateView):\n\n    model = models.Bplan\n    slug_url_kwarg = 'project_slug'\n    form_class = forms.BplanProjectCreateForm\n    template_name = \\\n        'meinberlin_bplan/bplan_create_dashboard.html'\n    success_message = _('Development plan successfully created.')\n\n    blueprint = ProjectBlueprint(\n        title=_('Development Plan'),\n        description=_('Create a statement formular for development plans'\n                      ' to be embedded on external sites.'),\n        content=[\n            bplan_phases.StatementPhase(),\n        ],\n        image='',\n        settings_model=None,\n    )\n\n\nclass BplanProjectUpdateView(ProjectComponentFormView):\n\n    model = models.Bplan\n\n    @property\n    def project(self):\n        project = super().project\n        return project.externalproject.bplan\n\n    def get_object(self, queryset=None):\n        return self.project\n\n\nclass BplanProjectListView(DashboardBaseMixin,\n                           generic.ListView):\n    model = models.Bplan\n    paginate_by = 12\n    template_name = 'meinberlin_bplan/bplan_list_dashboard.html'\n    permission_required = 'a4projects.add_project'\n    menu_item = 'project'\n\n    def get_queryset(self):\n        return super().get_queryset().filter(\n            organisation=self.organisation\n        )\n\n    def get_permission_object(self):\n        return self.organisation\n", "path": "meinberlin/apps/bplan/views.py"}, {"content": "import json\nfrom urllib import parse\n\nfrom django.apps import apps\nfrom django.contrib import messages\nfrom django.contrib.messages.views import SuccessMessageMixin\nfrom django.http import HttpResponseRedirect\nfrom django.urls import resolve\nfrom django.urls import reverse\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\nfrom django.views.generic.detail import SingleObjectMixin\n\nfrom adhocracy4.dashboard import mixins\nfrom adhocracy4.dashboard import signals\nfrom adhocracy4.dashboard import views as a4dashboard_views\nfrom adhocracy4.dashboard.blueprints import get_blueprints\nfrom adhocracy4.modules import models as module_models\nfrom adhocracy4.phases import models as phase_models\nfrom adhocracy4.projects import models as project_models\nfrom adhocracy4.projects.mixins import ProjectMixin\nfrom meinberlin.apps.dashboard.forms import DashboardProjectCreateForm\n\n\nclass ModuleBlueprintListView(ProjectMixin,\n                              mixins.DashboardBaseMixin,\n                              mixins.BlueprintMixin,\n                              generic.DetailView):\n    template_name = 'meinberlin_dashboard/module_blueprint_list_dashboard.html'\n    permission_required = 'a4projects.change_project'\n    model = project_models.Project\n    slug_url_kwarg = 'project_slug'\n    menu_item = 'project'\n\n    @property\n    def blueprints(self):\n        return get_blueprints()\n\n    def get_permission_object(self):\n        return self.project\n\n\nclass ModuleCreateView(ProjectMixin,\n                       mixins.DashboardBaseMixin,\n                       mixins.BlueprintMixin,\n                       SingleObjectMixin,\n                       generic.View):\n    permission_required = 'a4projects.change_project'\n    model = project_models.Project\n    slug_url_kwarg = 'project_slug'\n\n    def post(self, request, *args, **kwargs):\n        project = self.get_object()\n        weight = 1\n        if project.modules:\n            weight = max(\n                project.modules.values_list('weight', flat=True)\n            ) + 1\n        module = module_models.Module(\n            name=self.blueprint.title,\n            weight=weight,\n            project=project,\n            is_draft=True,\n        )\n        module.save()\n        signals.module_created.send(sender=None,\n                                    module=module,\n                                    user=self.request.user)\n\n        self._create_module_settings(module)\n        self._create_phases(module, self.blueprint.content)\n\n        cookie = request.COOKIES.get('dashboard_projects_closed_accordeons',\n                                     '[]')\n        ids = json.loads(parse.unquote(cookie))\n        if self.project.id not in ids:\n            ids.append(self.project.id)\n\n        cookie = parse.quote(json.dumps(ids))\n\n        response = HttpResponseRedirect(self.get_next(module))\n        response.set_cookie('dashboard_projects_closed_accordeons', cookie)\n        return response\n\n    def _create_module_settings(self, module):\n        if self.blueprint.settings_model:\n            settings_model = apps.get_model(*self.blueprint.settings_model)\n            module_settings = settings_model(module=module)\n            module_settings.save()\n\n    def _create_phases(self, module, blueprint_phases):\n        for index, phase_content in enumerate(blueprint_phases):\n            phase = phase_models.Phase(\n                type=phase_content.identifier,\n                name=phase_content.name,\n                description=phase_content.description,\n                weight=index,\n                module=module,\n            )\n            phase.save()\n\n    def get_next(self, module):\n        return reverse('a4dashboard:dashboard-module_basic-edit', kwargs={\n            'module_slug': module.slug\n        })\n\n    def get_permission_object(self):\n        return self.project\n\n\nclass ModulePublishView(SingleObjectMixin,\n                        generic.View):\n    permission_required = 'a4projects.change_project'\n    model = module_models.Module\n    slug_url_kwarg = 'module_slug'\n\n    def get_permission_object(self):\n        return self.get_object().project\n\n    def post(self, request, *args, **kwargs):\n        action = request.POST.get('action', None)\n        if action == 'publish':\n            self.publish_module()\n        elif action == 'unpublish':\n            self.unpublish_module()\n        else:\n            messages.warning(self.request, _('Invalid action'))\n\n        return HttpResponseRedirect(self.get_next())\n\n    def get_next(self):\n        if 'referrer' in self.request.POST:\n            return self.request.POST['referrer']\n        elif 'HTTP_REFERER' in self.request.META:\n            return self.request.META['HTTP_REFERER']\n\n        return reverse('a4dashboard:project-edit', kwargs={\n            'project_slug': self.project.slug\n        })\n\n    def publish_module(self):\n        module = self.get_object()\n        if not module.is_draft:\n            messages.info(self.request, _('Module is already added'))\n            return\n\n        module.is_draft = False\n        module.save()\n\n        signals.module_published.send(sender=None,\n                                      module=module,\n                                      user=self.request.user)\n\n        messages.success(self.request,\n                         _('Module successfully added.'))\n\n    def unpublish_module(self):\n        module = self.get_object()\n        if module.is_draft:\n            messages.info(self.request, _('Module is already removed'))\n            return\n\n        module.is_draft = True\n        module.save()\n\n        signals.module_unpublished.send(sender=None,\n                                        module=module,\n                                        user=self.request.user)\n\n        messages.success(self.request,\n                         _('Module successfully removed.'))\n\n\nclass ModuleDeleteView(generic.DeleteView):\n    permission_required = 'a4projects.change_project'\n    model = module_models.Module\n    success_message = _('The module has been deleted')\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.get_object().project\n\n    def get_success_url(self):\n        referrer = self.request.POST.get('referrer', None) \\\n            or self.request.META.get('HTTP_REFERER', None)\n        if referrer:\n            view, args, kwargs = resolve(referrer)\n            if 'module_slug' not in kwargs \\\n                    or not kwargs['module_slug'] == self.get_object().slug:\n                return referrer\n\n        return reverse('a4dashboard:project-edit', kwargs={\n            'project_slug': self.get_object().project.slug\n        })\n\n\nclass DashboardProjectListView(a4dashboard_views.ProjectListView):\n    def get_queryset(self):\n        return super().get_queryset().filter(\n            projectcontainer=None,\n            externalproject=None\n        )\n\n\nclass ProjectCreateView(mixins.DashboardBaseMixin,\n                        SuccessMessageMixin,\n                        generic.CreateView):\n    model = project_models.Project\n    slug_url_kwarg = 'project_slug'\n    form_class = DashboardProjectCreateForm\n    template_name = 'a4dashboard/project_create_form.html'\n    permission_required = 'a4projects.add_project'\n    menu_item = 'project'\n    success_message = _('Project successfully created.')\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['organisation'] = self.organisation\n        kwargs['creator'] = self.request.user\n        return kwargs\n\n    def get_success_url(self):\n        return reverse('a4dashboard:project-edit',\n                       kwargs={'project_slug': self.object.slug})\n\n    def form_valid(self, form):\n        response = super().form_valid(form)\n        signals.project_created.send(sender=None,\n                                     project=self.object,\n                                     user=self.request.user)\n\n        return response\n", "path": "meinberlin/apps/dashboard/views.py"}, {"content": "from django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\n\nfrom adhocracy4.dashboard.blueprints import ProjectBlueprint\nfrom adhocracy4.dashboard.components.forms.views import \\\n    ProjectComponentFormView\nfrom adhocracy4.dashboard.mixins import DashboardBaseMixin\nfrom adhocracy4.dashboard.views import ProjectCreateView\nfrom meinberlin.apps.extprojects import phases as extprojects_phases\n\nfrom . import apps\nfrom . import forms\nfrom . import models\n\n\nclass ExternalProjectCreateView(ProjectCreateView):\n\n    model = models.ExternalProject\n    slug_url_kwarg = 'project_slug'\n    form_class = forms.ExternalProjectCreateForm\n    template_name = \\\n        'meinberlin_extprojects/external_project_create_dashboard.html'\n    success_message = _('External project successfully created.')\n\n    blueprint = ProjectBlueprint(\n        title=_('Linkage'),\n        description=_(\n            'Linkages are handled on a different platform.'\n        ),\n        content=[\n            extprojects_phases.ExternalPhase(),\n        ],\n        image='',\n        settings_model=None,\n    )\n\n\nclass ExternalProjectUpdateView(ProjectComponentFormView):\n\n    model = models.ExternalProject\n\n    @property\n    def project(self):\n        project = super().project\n        return project.externalproject\n\n    def get_object(self, queryset=None):\n        return self.project\n\n\nclass ExternalProjectListView(DashboardBaseMixin,\n                              generic.ListView):\n    model = models.ExternalProject\n    paginate_by = 12\n    template_name = 'meinberlin_extprojects/extproject_list_dashboard.html'\n    permission_required = 'a4projects.add_project'\n    menu_item = 'project'\n\n    def get_queryset(self):\n        project_type = '{}.{}'.format(\n            apps.Config.label,\n            'ExternalProject'\n        )\n        return super().get_queryset().filter(\n            organisation=self.organisation,\n            project_type=project_type\n        )\n\n    def get_permission_object(self):\n        return self.organisation\n", "path": "meinberlin/apps/extprojects/views.py"}], "after_files": [{"content": "from django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\nfrom django.views.generic import TemplateView\n\nfrom adhocracy4.dashboard.blueprints import ProjectBlueprint\nfrom adhocracy4.dashboard.components.forms.views import \\\n    ProjectComponentFormView\nfrom adhocracy4.dashboard.mixins import DashboardBaseMixin\nfrom meinberlin.apps.bplan import phases as bplan_phases\nfrom meinberlin.apps.extprojects.views import ExternalProjectCreateView\n\nfrom . import forms\nfrom . import models\n\n\nclass BplanStatementSentView(TemplateView):\n    template_name = 'meinberlin_bplan/statement_sent.html'\n\n\nclass BplanFinishedView(TemplateView):\n    template_name = 'meinberlin_bplan/bplan_finished.html'\n\n\nclass BplanProjectCreateView(ExternalProjectCreateView):\n\n    model = models.Bplan\n    slug_url_kwarg = 'project_slug'\n    form_class = forms.BplanProjectCreateForm\n    template_name = \\\n        'meinberlin_bplan/bplan_create_dashboard.html'\n    success_message = _('Development plan was created.')\n\n    blueprint = ProjectBlueprint(\n        title=_('Development Plan'),\n        description=_('Create a statement formular for development plans'\n                      ' to be embedded on external sites.'),\n        content=[\n            bplan_phases.StatementPhase(),\n        ],\n        image='',\n        settings_model=None,\n    )\n\n\nclass BplanProjectUpdateView(ProjectComponentFormView):\n\n    model = models.Bplan\n\n    @property\n    def project(self):\n        project = super().project\n        return project.externalproject.bplan\n\n    def get_object(self, queryset=None):\n        return self.project\n\n\nclass BplanProjectListView(DashboardBaseMixin,\n                           generic.ListView):\n    model = models.Bplan\n    paginate_by = 12\n    template_name = 'meinberlin_bplan/bplan_list_dashboard.html'\n    permission_required = 'a4projects.add_project'\n    menu_item = 'project'\n\n    def get_queryset(self):\n        return super().get_queryset().filter(\n            organisation=self.organisation\n        )\n\n    def get_permission_object(self):\n        return self.organisation\n", "path": "meinberlin/apps/bplan/views.py"}, {"content": "import json\nfrom urllib import parse\n\nfrom django.apps import apps\nfrom django.contrib import messages\nfrom django.contrib.messages.views import SuccessMessageMixin\nfrom django.http import HttpResponseRedirect\nfrom django.urls import resolve\nfrom django.urls import reverse\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\nfrom django.views.generic.detail import SingleObjectMixin\n\nfrom adhocracy4.dashboard import mixins\nfrom adhocracy4.dashboard import signals\nfrom adhocracy4.dashboard import views as a4dashboard_views\nfrom adhocracy4.dashboard.blueprints import get_blueprints\nfrom adhocracy4.modules import models as module_models\nfrom adhocracy4.phases import models as phase_models\nfrom adhocracy4.projects import models as project_models\nfrom adhocracy4.projects.mixins import ProjectMixin\nfrom meinberlin.apps.dashboard.forms import DashboardProjectCreateForm\n\n\nclass ModuleBlueprintListView(ProjectMixin,\n                              mixins.DashboardBaseMixin,\n                              mixins.BlueprintMixin,\n                              generic.DetailView):\n    template_name = 'meinberlin_dashboard/module_blueprint_list_dashboard.html'\n    permission_required = 'a4projects.change_project'\n    model = project_models.Project\n    slug_url_kwarg = 'project_slug'\n    menu_item = 'project'\n\n    @property\n    def blueprints(self):\n        return get_blueprints()\n\n    def get_permission_object(self):\n        return self.project\n\n\nclass ModuleCreateView(ProjectMixin,\n                       mixins.DashboardBaseMixin,\n                       mixins.BlueprintMixin,\n                       SingleObjectMixin,\n                       generic.View):\n    permission_required = 'a4projects.change_project'\n    model = project_models.Project\n    slug_url_kwarg = 'project_slug'\n    success_message = _('The module was created')\n\n    def post(self, request, *args, **kwargs):\n        project = self.get_object()\n        weight = 1\n        if project.modules:\n            weight = max(\n                project.modules.values_list('weight', flat=True)\n            ) + 1\n        module = module_models.Module(\n            name=self.blueprint.title,\n            weight=weight,\n            project=project,\n            is_draft=True,\n        )\n        module.save()\n        signals.module_created.send(sender=None,\n                                    module=module,\n                                    user=self.request.user)\n\n        self._create_module_settings(module)\n        self._create_phases(module, self.blueprint.content)\n        messages.success(self.request, self.success_message)\n\n        cookie = request.COOKIES.get('dashboard_projects_closed_accordeons',\n                                     '[]')\n        ids = json.loads(parse.unquote(cookie))\n        if self.project.id not in ids:\n            ids.append(self.project.id)\n\n        cookie = parse.quote(json.dumps(ids))\n\n        response = HttpResponseRedirect(self.get_next(module))\n        response.set_cookie('dashboard_projects_closed_accordeons', cookie)\n        return response\n\n    def _create_module_settings(self, module):\n        if self.blueprint.settings_model:\n            settings_model = apps.get_model(*self.blueprint.settings_model)\n            module_settings = settings_model(module=module)\n            module_settings.save()\n\n    def _create_phases(self, module, blueprint_phases):\n        for index, phase_content in enumerate(blueprint_phases):\n            phase = phase_models.Phase(\n                type=phase_content.identifier,\n                name=phase_content.name,\n                description=phase_content.description,\n                weight=index,\n                module=module,\n            )\n            phase.save()\n\n    def get_next(self, module):\n        return reverse('a4dashboard:dashboard-module_basic-edit', kwargs={\n            'module_slug': module.slug\n        })\n\n    def get_permission_object(self):\n        return self.project\n\n\nclass ModulePublishView(SingleObjectMixin,\n                        generic.View):\n    permission_required = 'a4projects.change_project'\n    model = module_models.Module\n    slug_url_kwarg = 'module_slug'\n\n    def get_permission_object(self):\n        return self.get_object().project\n\n    def post(self, request, *args, **kwargs):\n        action = request.POST.get('action', None)\n        if action == 'publish':\n            self.publish_module()\n        elif action == 'unpublish':\n            self.unpublish_module()\n        else:\n            messages.warning(self.request, _('Invalid action'))\n\n        return HttpResponseRedirect(self.get_next())\n\n    def get_next(self):\n        if 'referrer' in self.request.POST:\n            return self.request.POST['referrer']\n        elif 'HTTP_REFERER' in self.request.META:\n            return self.request.META['HTTP_REFERER']\n\n        return reverse('a4dashboard:project-edit', kwargs={\n            'project_slug': self.project.slug\n        })\n\n    def publish_module(self):\n        module = self.get_object()\n        if not module.is_draft:\n            messages.info(self.request, _('Module is already added'))\n            return\n\n        module.is_draft = False\n        module.save()\n\n        signals.module_published.send(sender=None,\n                                      module=module,\n                                      user=self.request.user)\n\n        messages.success(self.request,\n                         _('The module is displayed in the project.'))\n\n    def unpublish_module(self):\n        module = self.get_object()\n        if module.is_draft:\n            messages.info(self.request, _('Module is already removed'))\n            return\n\n        module.is_draft = True\n        module.save()\n\n        signals.module_unpublished.send(sender=None,\n                                        module=module,\n                                        user=self.request.user)\n\n        messages.success(self.request,\n                         _('The module is no longer displayed in the project.'\n                           ))\n\n\nclass ModuleDeleteView(generic.DeleteView):\n    permission_required = 'a4projects.change_project'\n    model = module_models.Module\n    success_message = _('The module has been deleted')\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.get_object().project\n\n    def get_success_url(self):\n        referrer = self.request.POST.get('referrer', None) \\\n            or self.request.META.get('HTTP_REFERER', None)\n        if referrer:\n            view, args, kwargs = resolve(referrer)\n            if 'module_slug' not in kwargs \\\n                    or not kwargs['module_slug'] == self.get_object().slug:\n                return referrer\n\n        return reverse('a4dashboard:project-edit', kwargs={\n            'project_slug': self.get_object().project.slug\n        })\n\n\nclass DashboardProjectListView(a4dashboard_views.ProjectListView):\n    def get_queryset(self):\n        return super().get_queryset().filter(\n            projectcontainer=None,\n            externalproject=None\n        )\n\n\nclass ProjectCreateView(mixins.DashboardBaseMixin,\n                        SuccessMessageMixin,\n                        generic.CreateView):\n    model = project_models.Project\n    slug_url_kwarg = 'project_slug'\n    form_class = DashboardProjectCreateForm\n    template_name = 'a4dashboard/project_create_form.html'\n    permission_required = 'a4projects.add_project'\n    menu_item = 'project'\n    success_message = _('Project was created.')\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['organisation'] = self.organisation\n        kwargs['creator'] = self.request.user\n        return kwargs\n\n    def get_success_url(self):\n        return reverse('a4dashboard:project-edit',\n                       kwargs={'project_slug': self.object.slug})\n\n    def form_valid(self, form):\n        response = super().form_valid(form)\n        signals.project_created.send(sender=None,\n                                     project=self.object,\n                                     user=self.request.user)\n\n        return response\n", "path": "meinberlin/apps/dashboard/views.py"}, {"content": "from django.utils.translation import ugettext_lazy as _\nfrom django.views import generic\n\nfrom adhocracy4.dashboard.blueprints import ProjectBlueprint\nfrom adhocracy4.dashboard.components.forms.views import \\\n    ProjectComponentFormView\nfrom adhocracy4.dashboard.mixins import DashboardBaseMixin\nfrom adhocracy4.dashboard.views import ProjectCreateView\nfrom meinberlin.apps.extprojects import phases as extprojects_phases\n\nfrom . import apps\nfrom . import forms\nfrom . import models\n\n\nclass ExternalProjectCreateView(ProjectCreateView):\n\n    model = models.ExternalProject\n    slug_url_kwarg = 'project_slug'\n    form_class = forms.ExternalProjectCreateForm\n    template_name = \\\n        'meinberlin_extprojects/external_project_create_dashboard.html'\n    success_message = _('External project was created.')\n\n    blueprint = ProjectBlueprint(\n        title=_('Linkage'),\n        description=_(\n            'Linkages are handled on a different platform.'\n        ),\n        content=[\n            extprojects_phases.ExternalPhase(),\n        ],\n        image='',\n        settings_model=None,\n    )\n\n\nclass ExternalProjectUpdateView(ProjectComponentFormView):\n\n    model = models.ExternalProject\n\n    @property\n    def project(self):\n        project = super().project\n        return project.externalproject\n\n    def get_object(self, queryset=None):\n        return self.project\n\n\nclass ExternalProjectListView(DashboardBaseMixin,\n                              generic.ListView):\n    model = models.ExternalProject\n    paginate_by = 12\n    template_name = 'meinberlin_extprojects/extproject_list_dashboard.html'\n    permission_required = 'a4projects.add_project'\n    menu_item = 'project'\n\n    def get_queryset(self):\n        project_type = '{}.{}'.format(\n            apps.Config.label,\n            'ExternalProject'\n        )\n        return super().get_queryset().filter(\n            organisation=self.organisation,\n            project_type=project_type\n        )\n\n    def get_permission_object(self):\n        return self.organisation\n", "path": "meinberlin/apps/extprojects/views.py"}]}