We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Dashboard: Elements in organization/user switch are astray
The arrow and the label for the organization/user name should be in one line and vertically centered in the switch area. Keep in mind that there can be long names of two lines. 
![bildschirmfoto 2016-12-16 um 10 27 11](https://cloud.githubusercontent.com/assets/15341015/21257897/b99b37d4-c37a-11e6-84fb-9254f660f162.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: `euth/dashboard/views.py`
Content:
```
1 from allauth.account import views as account_views
2 from allauth.socialaccount import views as socialaccount_views
3 from django.contrib import messages
4 from django.contrib.messages.views import SuccessMessageMixin
5 from django.core.urlresolvers import reverse
6 from django.shortcuts import get_object_or_404, redirect
7 from django.utils import functional
8 from django.utils.translation import ugettext as _
9 from django.views import generic
10 from rules.compat import access_mixins as mixins
11 from rules.contrib import views as rules_views
12 
13 from adhocracy4.phases import models as phase_models
14 from adhocracy4.projects import models as project_models
15 from euth.memberships import models as member_models
16 from euth.organisations import models as org_models
17 from euth.users import models as user_models
18 
19 from . import blueprints, emails, forms
20 
21 
22 def dashboard(request):
23     return redirect('dashboard-profile')
24 
25 
26 class DashboardBaseMixin(mixins.LoginRequiredMixin,
27                          generic.base.ContextMixin,):
28 
29     @functional.cached_property
30     def user_has_organisation(self):
31         return bool(self.request.user.organisation_set.all())
32 
33     @functional.cached_property
34     def organisation(self):
35         if 'organisation_slug' in self.kwargs:
36             slug = self.kwargs['organisation_slug']
37             return get_object_or_404(org_models.Organisation, slug=slug)
38         else:
39             return self.request.user.organisation_set.first()
40 
41     @functional.cached_property
42     def other_organisations_of_user(self):
43         user = self.request.user
44         if self.organisation:
45             return user.organisation_set.exclude(pk=self.organisation.pk)
46         else:
47             return None
48 
49     @property
50     def raise_exception(self):
51         return self.request.user.is_authenticated()
52 
53 
54 class DashboardEmailView(DashboardBaseMixin, account_views.EmailView):
55     menu_item = 'email'
56 
57 
58 class DashboardAccountView(DashboardBaseMixin,
59                            socialaccount_views.ConnectionsView):
60     menu_item = 'connections'
61 
62 
63 class DashboardProfileView(DashboardBaseMixin,
64                            SuccessMessageMixin,
65                            generic.UpdateView):
66 
67     model = user_models.User
68     template_name = "euth_dashboard/profile_detail.html"
69     form_class = forms.ProfileForm
70     success_message = _("Your profile was successfully updated.")
71     menu_item = 'profile'
72 
73     def get_object(self):
74         return get_object_or_404(user_models.User, pk=self.request.user.id)
75 
76     def get_success_url(self):
77         return self.request.path
78 
79 
80 class ChangePasswordView(DashboardBaseMixin,
81                          account_views.PasswordChangeView):
82     menu_item = 'password'
83 
84     def get_success_url(self):
85         return reverse('dashboard-password')
86 
87 
88 class DashboardOrganisationUpdateView(DashboardBaseMixin,
89                                       rules_views.PermissionRequiredMixin,
90                                       SuccessMessageMixin,
91                                       generic.UpdateView):
92     model = org_models.Organisation
93     form_class = forms.OrganisationForm
94     slug_url_kwarg = 'organisation_slug'
95     template_name = 'euth_dashboard/organisation_form.html'
96     success_message = _('Organisation successfully updated.')
97     permission_required = 'euth_organisations.modify_organisation'
98     menu_item = 'organisation'
99 
100     def get_success_url(self):
101         return self.request.path
102 
103 
104 class DashboardProjectListView(DashboardBaseMixin,
105                                rules_views.PermissionRequiredMixin,
106                                generic.ListView):
107     model = project_models.Project
108     template_name = 'euth_dashboard/project_list.html'
109     permission_required = 'euth_organisations.modify_organisation'
110     menu_item = 'project'
111 
112     def get_queryset(self):
113         return self.model.objects.filter(
114             organisation=self.organisation
115         )
116 
117     def get_permission_object(self):
118         return self.organisation
119 
120     def get_success_url(self):
121         return reverse('dashboard-project-list')
122 
123 
124 class DashboardBlueprintListView(DashboardBaseMixin,
125                                  rules_views.PermissionRequiredMixin,
126                                  generic.TemplateView):
127     template_name = 'euth_dashboard/blueprint_list.html'
128     blueprints = blueprints.blueprints
129     permission_required = 'euth_organisations.initiate_project'
130     menu_item = 'project'
131 
132     def get_permission_object(self):
133         return self.organisation
134 
135 
136 class DashboardProjectCreateView(DashboardBaseMixin,
137                                  rules_views.PermissionRequiredMixin,
138                                  SuccessMessageMixin,
139                                  blueprints.BlueprintMixin,
140                                  generic.CreateView):
141     model = project_models.Project
142     form_class = forms.ProjectCreateForm
143     template_name = 'euth_dashboard/project_form.html'
144     success_message = _('Project succesfully created.')
145     permission_required = 'euth_organisations.initiate_project'
146     menu_item = 'project'
147 
148     def get_context_data(self, **kwargs):
149         context = super().get_context_data(**kwargs)
150         context['heading'] = _("New project based on")
151         return context
152 
153     def get_permission_object(self):
154         return self.organisation
155 
156     def get_form_kwargs(self):
157         kwargs = super().get_form_kwargs()
158         kwargs['blueprint'] = self.blueprint
159         kwargs['organisation'] = self.organisation
160         kwargs['creator'] = self.request.user
161         return kwargs
162 
163     def get_success_url(self):
164         return reverse('dashboard-project-list',
165                        kwargs={
166                            'organisation_slug': self.organisation.slug,
167                        })
168 
169 
170 class DashboardProjectUpdateView(DashboardBaseMixin,
171                                  rules_views.PermissionRequiredMixin,
172                                  SuccessMessageMixin,
173                                  generic.UpdateView):
174     model = project_models.Project
175     form_class = forms.ProjectUpdateForm
176     template_name = 'euth_dashboard/project_form.html'
177     success_message = _('Project successfully updated.')
178     permission_required = 'euth_organisations.initiate_project'
179     menu_item = 'project'
180 
181     def get_context_data(self, **kwargs):
182         context = super().get_context_data(**kwargs)
183         context['heading'] = _("Update project: " + self.object.name)
184         return context
185 
186     def get_permission_object(self):
187         return self.organisation
188 
189     def get_success_url(self):
190         return reverse('dashboard-project-edit',
191                        kwargs={
192                            'organisation_slug': self.organisation.slug,
193                            'slug': self.get_object().slug
194                        })
195 
196     def get_form_kwargs(self):
197         kwargs = super().get_form_kwargs()
198         qs = phase_models.Phase.objects.filter(module__project=self.object)
199         kwargs['phases__queryset'] = qs
200 
201         if qs.first().module.settings_instance:
202             settings_instance = qs.first().module.settings_instance
203             kwargs['module_settings__instance'] = settings_instance
204 
205         return kwargs
206 
207 
208 class DashboardProjectDeleteView(DashboardBaseMixin,
209                                  rules_views.PermissionRequiredMixin,
210                                  generic.DeleteView):
211     model = project_models.Project
212     form_class = forms.ProjectUpdateForm
213     permission_required = 'euth_organisations.initiate_project'
214     success_message = _('Your project has been deleted.')
215     menu_item = 'project'
216 
217     @property
218     def raise_exception(self):
219         return self.request.user.is_authenticated()
220 
221     def delete(self, *args, **kwargs):
222         response = super().delete(*args, **kwargs)
223         emails.ProjectDeletedEmail.send(
224             self.object,
225             action_user=self.request.user
226         )
227         success_message = self.success_message
228         messages.success(self.request, success_message)
229         return response
230 
231     def get_success_url(self):
232         return reverse('dashboard-project-list',
233                        kwargs={
234                            'organisation_slug': self.organisation.slug
235                        })
236 
237 
238 class DashboardProjectInviteView(DashboardBaseMixin,
239                                  rules_views.PermissionRequiredMixin,
240                                  SuccessMessageMixin,
241                                  generic.FormView):
242     form_class = forms.ProjectInviteForm
243     template_name = 'euth_dashboard/project_invites.html'
244     success_message = _("Invitations successfully sent.")
245     permission_required = 'euth_organisations.initiate_project'
246     menu_item = 'project'
247 
248     def get_permission_object(self):
249         return self.organisation
250 
251     @functional.cached_property
252     def project(self):
253         return project_models.Project.objects.get(
254             slug=self.kwargs['slug']
255         )
256 
257     def get_form_kwargs(self):
258         kwargs = super().get_form_kwargs()
259         kwargs['project'] = self.project
260         return kwargs
261 
262     def form_valid(self, form):
263         emails = form.cleaned_data['emails']
264         user = self.request.user
265         project = self.project
266         for email in emails:
267             member_models.Invite.objects.invite(user, project, email)
268         return super().form_valid(form)
269 
270     def get_success_url(self):
271         return reverse('dashboard-project-users',
272                        kwargs={
273                            'organisation_slug': self.organisation.slug,
274                            'slug': self.project.slug
275                        })
276 
277 
278 class DashboardProjectUserView(DashboardBaseMixin,
279                                rules_views.PermissionRequiredMixin,
280                                SuccessMessageMixin,
281                                generic.FormView):
282 
283     form_class = forms.ProjectUserForm
284     template_name = 'euth_dashboard/project_users.html'
285     success_message = _("User request successfully updated.")
286     permission_required = 'euth_organisations.initiate_project'
287     menu_item = 'project'
288 
289     def get_permission_object(self):
290         return self.organisation
291 
292     def get_form_kwargs(self):
293         kwargs = super().get_form_kwargs()
294         qs = member_models.Request.objects.order_by('created').filter(
295             project__slug=self.kwargs['slug']
296         )
297         kwargs['requests__queryset'] = qs
298         qs = member_models.Invite.objects.order_by('created').filter(
299             project__slug=self.kwargs['slug']
300         )
301         kwargs['invites__queryset'] = qs
302         qs = user_models.User.objects.order_by('email').filter(
303             project_participant__slug=self.kwargs['slug']
304         )
305         kwargs['users__queryset'] = qs
306         kwargs['project'] = self.project
307         return kwargs
308 
309     @functional.cached_property
310     def project(self):
311         return project_models.Project.objects.get(
312             slug=self.kwargs['slug']
313         )
314 
315     def get_context_data(self, **kwargs):
316         context = super().get_context_data(**kwargs)
317         context['project'] = self.project
318         return context
319 
320     def get_success_url(self):
321         return self.request.path
322 
323     def form_valid(self, form):
324         form.save()
325         return super().form_valid(form)
326
```
--- 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/euth/dashboard/views.py b/euth/dashboard/views.py
--- a/euth/dashboard/views.py
+++ b/euth/dashboard/views.py
@@ -187,10 +187,9 @@
         return self.organisation
 
     def get_success_url(self):
-        return reverse('dashboard-project-edit',
+        return reverse('dashboard-project-list',
                        kwargs={
                            'organisation_slug': self.organisation.slug,
-                           'slug': self.get_object().slug
                        })
 
     def get_form_kwargs(self):

{"golden_diff": "diff --git a/euth/dashboard/views.py b/euth/dashboard/views.py\n--- a/euth/dashboard/views.py\n+++ b/euth/dashboard/views.py\n@@ -187,10 +187,9 @@\n         return self.organisation\n \n     def get_success_url(self):\n-        return reverse('dashboard-project-edit',\n+        return reverse('dashboard-project-list',\n                        kwargs={\n                            'organisation_slug': self.organisation.slug,\n-                           'slug': self.get_object().slug\n                        })\n \n     def get_form_kwargs(self):\n", "issue": "Dashboard: Elements in organization/user switch are astray\nThe arrow and the label for the organization/user name should be in one line and vertically centered in the switch area. Keep in mind that there can be long names of two lines. \r\n![bildschirmfoto 2016-12-16 um 10 27 11](https://cloud.githubusercontent.com/assets/15341015/21257897/b99b37d4-c37a-11e6-84fb-9254f660f162.png)\r\n\n", "before_files": [{"content": "from allauth.account import views as account_views\nfrom allauth.socialaccount import views as socialaccount_views\nfrom django.contrib import messages\nfrom django.contrib.messages.views import SuccessMessageMixin\nfrom django.core.urlresolvers import reverse\nfrom django.shortcuts import get_object_or_404, redirect\nfrom django.utils import functional\nfrom django.utils.translation import ugettext as _\nfrom django.views import generic\nfrom rules.compat import access_mixins as mixins\nfrom rules.contrib import views as rules_views\n\nfrom adhocracy4.phases import models as phase_models\nfrom adhocracy4.projects import models as project_models\nfrom euth.memberships import models as member_models\nfrom euth.organisations import models as org_models\nfrom euth.users import models as user_models\n\nfrom . import blueprints, emails, forms\n\n\ndef dashboard(request):\n    return redirect('dashboard-profile')\n\n\nclass DashboardBaseMixin(mixins.LoginRequiredMixin,\n                         generic.base.ContextMixin,):\n\n    @functional.cached_property\n    def user_has_organisation(self):\n        return bool(self.request.user.organisation_set.all())\n\n    @functional.cached_property\n    def organisation(self):\n        if 'organisation_slug' in self.kwargs:\n            slug = self.kwargs['organisation_slug']\n            return get_object_or_404(org_models.Organisation, slug=slug)\n        else:\n            return self.request.user.organisation_set.first()\n\n    @functional.cached_property\n    def other_organisations_of_user(self):\n        user = self.request.user\n        if self.organisation:\n            return user.organisation_set.exclude(pk=self.organisation.pk)\n        else:\n            return None\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\n\n\nclass DashboardEmailView(DashboardBaseMixin, account_views.EmailView):\n    menu_item = 'email'\n\n\nclass DashboardAccountView(DashboardBaseMixin,\n                           socialaccount_views.ConnectionsView):\n    menu_item = 'connections'\n\n\nclass DashboardProfileView(DashboardBaseMixin,\n                           SuccessMessageMixin,\n                           generic.UpdateView):\n\n    model = user_models.User\n    template_name = \"euth_dashboard/profile_detail.html\"\n    form_class = forms.ProfileForm\n    success_message = _(\"Your profile was successfully updated.\")\n    menu_item = 'profile'\n\n    def get_object(self):\n        return get_object_or_404(user_models.User, pk=self.request.user.id)\n\n    def get_success_url(self):\n        return self.request.path\n\n\nclass ChangePasswordView(DashboardBaseMixin,\n                         account_views.PasswordChangeView):\n    menu_item = 'password'\n\n    def get_success_url(self):\n        return reverse('dashboard-password')\n\n\nclass DashboardOrganisationUpdateView(DashboardBaseMixin,\n                                      rules_views.PermissionRequiredMixin,\n                                      SuccessMessageMixin,\n                                      generic.UpdateView):\n    model = org_models.Organisation\n    form_class = forms.OrganisationForm\n    slug_url_kwarg = 'organisation_slug'\n    template_name = 'euth_dashboard/organisation_form.html'\n    success_message = _('Organisation successfully updated.')\n    permission_required = 'euth_organisations.modify_organisation'\n    menu_item = 'organisation'\n\n    def get_success_url(self):\n        return self.request.path\n\n\nclass DashboardProjectListView(DashboardBaseMixin,\n                               rules_views.PermissionRequiredMixin,\n                               generic.ListView):\n    model = project_models.Project\n    template_name = 'euth_dashboard/project_list.html'\n    permission_required = 'euth_organisations.modify_organisation'\n    menu_item = 'project'\n\n    def get_queryset(self):\n        return self.model.objects.filter(\n            organisation=self.organisation\n        )\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse('dashboard-project-list')\n\n\nclass DashboardBlueprintListView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 generic.TemplateView):\n    template_name = 'euth_dashboard/blueprint_list.html'\n    blueprints = blueprints.blueprints\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n\nclass DashboardProjectCreateView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 SuccessMessageMixin,\n                                 blueprints.BlueprintMixin,\n                                 generic.CreateView):\n    model = project_models.Project\n    form_class = forms.ProjectCreateForm\n    template_name = 'euth_dashboard/project_form.html'\n    success_message = _('Project succesfully created.')\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['heading'] = _(\"New project based on\")\n        return context\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['blueprint'] = self.blueprint\n        kwargs['organisation'] = self.organisation\n        kwargs['creator'] = self.request.user\n        return kwargs\n\n    def get_success_url(self):\n        return reverse('dashboard-project-list',\n                       kwargs={\n                           'organisation_slug': self.organisation.slug,\n                       })\n\n\nclass DashboardProjectUpdateView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 SuccessMessageMixin,\n                                 generic.UpdateView):\n    model = project_models.Project\n    form_class = forms.ProjectUpdateForm\n    template_name = 'euth_dashboard/project_form.html'\n    success_message = _('Project successfully updated.')\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['heading'] = _(\"Update project: \" + self.object.name)\n        return context\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse('dashboard-project-edit',\n                       kwargs={\n                           'organisation_slug': self.organisation.slug,\n                           'slug': self.get_object().slug\n                       })\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        qs = phase_models.Phase.objects.filter(module__project=self.object)\n        kwargs['phases__queryset'] = qs\n\n        if qs.first().module.settings_instance:\n            settings_instance = qs.first().module.settings_instance\n            kwargs['module_settings__instance'] = settings_instance\n\n        return kwargs\n\n\nclass DashboardProjectDeleteView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 generic.DeleteView):\n    model = project_models.Project\n    form_class = forms.ProjectUpdateForm\n    permission_required = 'euth_organisations.initiate_project'\n    success_message = _('Your project has been deleted.')\n    menu_item = 'project'\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\n\n    def delete(self, *args, **kwargs):\n        response = super().delete(*args, **kwargs)\n        emails.ProjectDeletedEmail.send(\n            self.object,\n            action_user=self.request.user\n        )\n        success_message = self.success_message\n        messages.success(self.request, success_message)\n        return response\n\n    def get_success_url(self):\n        return reverse('dashboard-project-list',\n                       kwargs={\n                           'organisation_slug': self.organisation.slug\n                       })\n\n\nclass DashboardProjectInviteView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 SuccessMessageMixin,\n                                 generic.FormView):\n    form_class = forms.ProjectInviteForm\n    template_name = 'euth_dashboard/project_invites.html'\n    success_message = _(\"Invitations successfully sent.\")\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n    @functional.cached_property\n    def project(self):\n        return project_models.Project.objects.get(\n            slug=self.kwargs['slug']\n        )\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['project'] = self.project\n        return kwargs\n\n    def form_valid(self, form):\n        emails = form.cleaned_data['emails']\n        user = self.request.user\n        project = self.project\n        for email in emails:\n            member_models.Invite.objects.invite(user, project, email)\n        return super().form_valid(form)\n\n    def get_success_url(self):\n        return reverse('dashboard-project-users',\n                       kwargs={\n                           'organisation_slug': self.organisation.slug,\n                           'slug': self.project.slug\n                       })\n\n\nclass DashboardProjectUserView(DashboardBaseMixin,\n                               rules_views.PermissionRequiredMixin,\n                               SuccessMessageMixin,\n                               generic.FormView):\n\n    form_class = forms.ProjectUserForm\n    template_name = 'euth_dashboard/project_users.html'\n    success_message = _(\"User request successfully updated.\")\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\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        qs = member_models.Request.objects.order_by('created').filter(\n            project__slug=self.kwargs['slug']\n        )\n        kwargs['requests__queryset'] = qs\n        qs = member_models.Invite.objects.order_by('created').filter(\n            project__slug=self.kwargs['slug']\n        )\n        kwargs['invites__queryset'] = qs\n        qs = user_models.User.objects.order_by('email').filter(\n            project_participant__slug=self.kwargs['slug']\n        )\n        kwargs['users__queryset'] = qs\n        kwargs['project'] = self.project\n        return kwargs\n\n    @functional.cached_property\n    def project(self):\n        return project_models.Project.objects.get(\n            slug=self.kwargs['slug']\n        )\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['project'] = self.project\n        return context\n\n    def get_success_url(self):\n        return self.request.path\n\n    def form_valid(self, form):\n        form.save()\n        return super().form_valid(form)\n", "path": "euth/dashboard/views.py"}], "after_files": [{"content": "from allauth.account import views as account_views\nfrom allauth.socialaccount import views as socialaccount_views\nfrom django.contrib import messages\nfrom django.contrib.messages.views import SuccessMessageMixin\nfrom django.core.urlresolvers import reverse\nfrom django.shortcuts import get_object_or_404, redirect\nfrom django.utils import functional\nfrom django.utils.translation import ugettext as _\nfrom django.views import generic\nfrom rules.compat import access_mixins as mixins\nfrom rules.contrib import views as rules_views\n\nfrom adhocracy4.phases import models as phase_models\nfrom adhocracy4.projects import models as project_models\nfrom euth.memberships import models as member_models\nfrom euth.organisations import models as org_models\nfrom euth.users import models as user_models\n\nfrom . import blueprints, emails, forms\n\n\ndef dashboard(request):\n    return redirect('dashboard-profile')\n\n\nclass DashboardBaseMixin(mixins.LoginRequiredMixin,\n                         generic.base.ContextMixin,):\n\n    @functional.cached_property\n    def user_has_organisation(self):\n        return bool(self.request.user.organisation_set.all())\n\n    @functional.cached_property\n    def organisation(self):\n        if 'organisation_slug' in self.kwargs:\n            slug = self.kwargs['organisation_slug']\n            return get_object_or_404(org_models.Organisation, slug=slug)\n        else:\n            return self.request.user.organisation_set.first()\n\n    @functional.cached_property\n    def other_organisations_of_user(self):\n        user = self.request.user\n        if self.organisation:\n            return user.organisation_set.exclude(pk=self.organisation.pk)\n        else:\n            return None\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\n\n\nclass DashboardEmailView(DashboardBaseMixin, account_views.EmailView):\n    menu_item = 'email'\n\n\nclass DashboardAccountView(DashboardBaseMixin,\n                           socialaccount_views.ConnectionsView):\n    menu_item = 'connections'\n\n\nclass DashboardProfileView(DashboardBaseMixin,\n                           SuccessMessageMixin,\n                           generic.UpdateView):\n\n    model = user_models.User\n    template_name = \"euth_dashboard/profile_detail.html\"\n    form_class = forms.ProfileForm\n    success_message = _(\"Your profile was successfully updated.\")\n    menu_item = 'profile'\n\n    def get_object(self):\n        return get_object_or_404(user_models.User, pk=self.request.user.id)\n\n    def get_success_url(self):\n        return self.request.path\n\n\nclass ChangePasswordView(DashboardBaseMixin,\n                         account_views.PasswordChangeView):\n    menu_item = 'password'\n\n    def get_success_url(self):\n        return reverse('dashboard-password')\n\n\nclass DashboardOrganisationUpdateView(DashboardBaseMixin,\n                                      rules_views.PermissionRequiredMixin,\n                                      SuccessMessageMixin,\n                                      generic.UpdateView):\n    model = org_models.Organisation\n    form_class = forms.OrganisationForm\n    slug_url_kwarg = 'organisation_slug'\n    template_name = 'euth_dashboard/organisation_form.html'\n    success_message = _('Organisation successfully updated.')\n    permission_required = 'euth_organisations.modify_organisation'\n    menu_item = 'organisation'\n\n    def get_success_url(self):\n        return self.request.path\n\n\nclass DashboardProjectListView(DashboardBaseMixin,\n                               rules_views.PermissionRequiredMixin,\n                               generic.ListView):\n    model = project_models.Project\n    template_name = 'euth_dashboard/project_list.html'\n    permission_required = 'euth_organisations.modify_organisation'\n    menu_item = 'project'\n\n    def get_queryset(self):\n        return self.model.objects.filter(\n            organisation=self.organisation\n        )\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse('dashboard-project-list')\n\n\nclass DashboardBlueprintListView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 generic.TemplateView):\n    template_name = 'euth_dashboard/blueprint_list.html'\n    blueprints = blueprints.blueprints\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n\nclass DashboardProjectCreateView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 SuccessMessageMixin,\n                                 blueprints.BlueprintMixin,\n                                 generic.CreateView):\n    model = project_models.Project\n    form_class = forms.ProjectCreateForm\n    template_name = 'euth_dashboard/project_form.html'\n    success_message = _('Project succesfully created.')\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['heading'] = _(\"New project based on\")\n        return context\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['blueprint'] = self.blueprint\n        kwargs['organisation'] = self.organisation\n        kwargs['creator'] = self.request.user\n        return kwargs\n\n    def get_success_url(self):\n        return reverse('dashboard-project-list',\n                       kwargs={\n                           'organisation_slug': self.organisation.slug,\n                       })\n\n\nclass DashboardProjectUpdateView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 SuccessMessageMixin,\n                                 generic.UpdateView):\n    model = project_models.Project\n    form_class = forms.ProjectUpdateForm\n    template_name = 'euth_dashboard/project_form.html'\n    success_message = _('Project successfully updated.')\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['heading'] = _(\"Update project: \" + self.object.name)\n        return context\n\n    def get_permission_object(self):\n        return self.organisation\n\n    def get_success_url(self):\n        return reverse('dashboard-project-list',\n                       kwargs={\n                           'organisation_slug': self.organisation.slug,\n                       })\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        qs = phase_models.Phase.objects.filter(module__project=self.object)\n        kwargs['phases__queryset'] = qs\n\n        if qs.first().module.settings_instance:\n            settings_instance = qs.first().module.settings_instance\n            kwargs['module_settings__instance'] = settings_instance\n\n        return kwargs\n\n\nclass DashboardProjectDeleteView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 generic.DeleteView):\n    model = project_models.Project\n    form_class = forms.ProjectUpdateForm\n    permission_required = 'euth_organisations.initiate_project'\n    success_message = _('Your project has been deleted.')\n    menu_item = 'project'\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\n\n    def delete(self, *args, **kwargs):\n        response = super().delete(*args, **kwargs)\n        emails.ProjectDeletedEmail.send(\n            self.object,\n            action_user=self.request.user\n        )\n        success_message = self.success_message\n        messages.success(self.request, success_message)\n        return response\n\n    def get_success_url(self):\n        return reverse('dashboard-project-list',\n                       kwargs={\n                           'organisation_slug': self.organisation.slug\n                       })\n\n\nclass DashboardProjectInviteView(DashboardBaseMixin,\n                                 rules_views.PermissionRequiredMixin,\n                                 SuccessMessageMixin,\n                                 generic.FormView):\n    form_class = forms.ProjectInviteForm\n    template_name = 'euth_dashboard/project_invites.html'\n    success_message = _(\"Invitations successfully sent.\")\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n    @functional.cached_property\n    def project(self):\n        return project_models.Project.objects.get(\n            slug=self.kwargs['slug']\n        )\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['project'] = self.project\n        return kwargs\n\n    def form_valid(self, form):\n        emails = form.cleaned_data['emails']\n        user = self.request.user\n        project = self.project\n        for email in emails:\n            member_models.Invite.objects.invite(user, project, email)\n        return super().form_valid(form)\n\n    def get_success_url(self):\n        return reverse('dashboard-project-users',\n                       kwargs={\n                           'organisation_slug': self.organisation.slug,\n                           'slug': self.project.slug\n                       })\n\n\nclass DashboardProjectUserView(DashboardBaseMixin,\n                               rules_views.PermissionRequiredMixin,\n                               SuccessMessageMixin,\n                               generic.FormView):\n\n    form_class = forms.ProjectUserForm\n    template_name = 'euth_dashboard/project_users.html'\n    success_message = _(\"User request successfully updated.\")\n    permission_required = 'euth_organisations.initiate_project'\n    menu_item = 'project'\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        qs = member_models.Request.objects.order_by('created').filter(\n            project__slug=self.kwargs['slug']\n        )\n        kwargs['requests__queryset'] = qs\n        qs = member_models.Invite.objects.order_by('created').filter(\n            project__slug=self.kwargs['slug']\n        )\n        kwargs['invites__queryset'] = qs\n        qs = user_models.User.objects.order_by('email').filter(\n            project_participant__slug=self.kwargs['slug']\n        )\n        kwargs['users__queryset'] = qs\n        kwargs['project'] = self.project\n        return kwargs\n\n    @functional.cached_property\n    def project(self):\n        return project_models.Project.objects.get(\n            slug=self.kwargs['slug']\n        )\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['project'] = self.project\n        return context\n\n    def get_success_url(self):\n        return self.request.path\n\n    def form_valid(self, form):\n        form.save()\n        return super().form_valid(form)\n", "path": "euth/dashboard/views.py"}]}