We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Name of Template visible while creating the project
Hi, when creating a project with a template it would be helpful to see the name of the project type. Maybe in the black button? 
The author/creator currently has no idea which template s/he chose and in case s/he saves it and returns to it, it may appear helpful to know which one s/he choose. Thanks & Best

![bildschirmfoto 2016-10-06 um 13 43 25](https://cloud.githubusercontent.com/assets/13625047/19151541/80ffe6b6-8bcd-11e6-8ca9-fb7e778f91fe.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.messages.views import SuccessMessageMixin
4 from django.core.urlresolvers import reverse
5 from django.shortcuts import get_object_or_404, redirect
6 from django.utils import functional
7 from django.utils.translation import ugettext as _
8 from django.views import generic
9 from rules.compat import access_mixins as mixins
10 from rules.contrib import views as rules_views
11 
12 from euth.memberships import models as member_models
13 from euth.organisations import models as org_models
14 from euth.phases import models as phase_models
15 from euth.projects import models as project_models
16 from euth.users import models as user_models
17 
18 from . import blueprints, forms
19 
20 
21 def dashboard(request):
22     return redirect('dashboard-profile')
23 
24 
25 class DashboardBaseMixin(mixins.LoginRequiredMixin,
26                          generic.base.ContextMixin,):
27 
28     @functional.cached_property
29     def user_has_organisation(self):
30         return bool(self.request.user.organisation_set.all())
31 
32     @functional.cached_property
33     def organisation(self):
34         if 'organisation_slug' in self.kwargs:
35             slug = self.kwargs['organisation_slug']
36             return get_object_or_404(org_models.Organisation, slug=slug)
37         else:
38             return self.request.user.organisation_set.first()
39 
40     @functional.cached_property
41     def other_organisations_of_user(self):
42         user = self.request.user
43         return user.organisation_set.exclude(pk=self.organisation.pk)
44 
45 
46 class DashboardEmailView(DashboardBaseMixin, account_views.EmailView):
47     pass
48 
49 
50 class DashboardAccountView(DashboardBaseMixin,
51                            socialaccount_views.ConnectionsView):
52     pass
53 
54 
55 class DashboardProfileView(DashboardBaseMixin,
56                            SuccessMessageMixin,
57                            generic.UpdateView):
58 
59     model = user_models.User
60     template_name = "euth_dashboard/profile_detail.html"
61     form_class = forms.ProfileForm
62     success_message = _("Your profile was successfully updated.")
63 
64     def get_object(self):
65         return get_object_or_404(user_models.User, pk=self.request.user.id)
66 
67     def get_success_url(self):
68         return self.request.path
69 
70 
71 class DashboardOrganisationUpdateView(DashboardBaseMixin,
72                                       rules_views.PermissionRequiredMixin,
73                                       SuccessMessageMixin,
74                                       generic.UpdateView):
75     model = org_models.Organisation
76     form_class = forms.OrganisationForm
77     slug_url_kwarg = 'organisation_slug'
78     template_name = 'euth_dashboard/organisation_form.html'
79     success_message = _('Organisation successfully updated.')
80     permission_required = 'euth_organisations.modify_organisation'
81 
82     def get_success_url(self):
83         return self.request.path
84 
85 
86 class DashboardProjectListView(DashboardBaseMixin,
87                                rules_views.PermissionRequiredMixin,
88                                generic.ListView):
89     model = project_models.Project
90     template_name = 'euth_dashboard/project_list.html'
91     permission_required = 'euth_organisations.modify_organisation'
92 
93     def get_queryset(self):
94         return self.model.objects.filter(
95             organisation=self.organisation
96         )
97 
98     def get_permission_object(self):
99         return self.organisation
100 
101     @property
102     def raise_exception(self):
103         return self.request.user.is_authenticated()
104 
105     def get_success_url(self):
106         return reverse('dashboard-project-list')
107 
108 
109 class DashboardBlueprintListView(DashboardBaseMixin,
110                                  rules_views.PermissionRequiredMixin,
111                                  generic.TemplateView):
112     template_name = 'euth_dashboard/blueprint_list.html'
113     blueprints = blueprints.blueprints
114     permission_required = 'euth_organisations.initiate_project'
115 
116 
117 class DashboardProjectCreateView(DashboardBaseMixin,
118                                  rules_views.PermissionRequiredMixin,
119                                  SuccessMessageMixin,
120                                  blueprints.BlueprintMixin,
121                                  generic.CreateView):
122     model = project_models.Project
123     form_class = forms.ProjectCreateForm
124     template_name = 'euth_dashboard/project_form.html'
125     success_message = _('Project succesfully created.')
126     permission_required = 'euth_organisations.initiate_project'
127 
128     def get_permission_object(self):
129         return self.organisation
130 
131     @property
132     def raise_exception(self):
133         return self.request.user.is_authenticated()
134 
135     def get_form_kwargs(self):
136         kwargs = super().get_form_kwargs()
137         kwargs['blueprint'] = self.blueprint
138         kwargs['organisation'] = self.organisation
139         return kwargs
140 
141     def get_success_url(self):
142         return reverse('dashboard-project-list',
143                        kwargs={
144                            'organisation_slug': self.organisation.slug,
145                        })
146 
147 
148 class DashboardProjectUpdateView(DashboardBaseMixin,
149                                  rules_views.PermissionRequiredMixin,
150                                  SuccessMessageMixin,
151                                  generic.UpdateView):
152     model = project_models.Project
153     form_class = forms.ProjectCompleteForm
154     template_name = 'euth_dashboard/project_form.html'
155     success_message = _('Project successfully updated.')
156     permission_required = 'euth_organisations.initiate_project'
157 
158     def get_permission_object(self):
159         return self.organisation
160 
161     @property
162     def raise_exception(self):
163         return self.request.user.is_authenticated()
164 
165     def get_success_url(self):
166             return reverse('dashboard-project-edit',
167                            kwargs={
168                                'organisation_slug': self.organisation.slug,
169                                'slug': self.get_object().slug
170                            })
171 
172     def get_form_kwargs(self):
173         kwargs = super().get_form_kwargs()
174         qs = phase_models.Phase.objects.filter(module__project=self.object)
175         kwargs['phases__queryset'] = qs
176         return kwargs
177 
178 
179 class DashboardProjectInviteView(DashboardBaseMixin,
180                                  rules_views.PermissionRequiredMixin,
181                                  SuccessMessageMixin,
182                                  generic.FormView):
183     form_class = forms.ProjectInviteForm
184     template_name = 'euth_dashboard/project_invites.html'
185     success_message = _("Invitations successfully sent.")
186     permission_required = 'euth_organisations.initiate_project'
187 
188     def get_permission_object(self):
189         return self.organisation
190 
191     @property
192     def raise_exception(self):
193         return self.request.user.is_authenticated()
194 
195     @functional.cached_property
196     def project(self):
197         return project_models.Project.objects.get(
198             slug=self.kwargs['slug']
199         )
200 
201     def get_form_kwargs(self):
202         kwargs = super().get_form_kwargs()
203         kwargs['project'] = self.project
204         return kwargs
205 
206     def form_valid(self, form):
207         emails = form.cleaned_data['emails']
208         user = self.request.user
209         project = self.project
210         for (name, address) in emails:
211             member_models.Invite.objects.invite(user, project, address)
212         return super().form_valid(form)
213 
214     def get_success_url(self):
215         return reverse('dashboard-project-users',
216                        kwargs={
217                            'organisation_slug': self.organisation.slug,
218                            'slug': self.project.slug
219                        })
220 
221 
222 class DashboardProjectUserView(DashboardBaseMixin,
223                                rules_views.PermissionRequiredMixin,
224                                SuccessMessageMixin,
225                                generic.FormView):
226 
227     form_class = forms.ProjectUserForm
228     template_name = 'euth_dashboard/project_users.html'
229     success_message = _("User request successfully updated.")
230     permission_required = 'euth_organisations.initiate_project'
231 
232     def get_permission_object(self):
233         return self.organisation
234 
235     @property
236     def raise_exception(self):
237         return self.request.user.is_authenticated()
238 
239     def get_form_kwargs(self):
240         kwargs = super().get_form_kwargs()
241         qs = member_models.Request.objects.order_by('created').filter(
242             project__slug=self.kwargs['slug']
243         )
244         kwargs['requests__queryset'] = qs
245         qs = member_models.Invite.objects.order_by('created').filter(
246             project__slug=self.kwargs['slug']
247         )
248         kwargs['invites__queryset'] = qs
249         qs = user_models.User.objects.order_by('email').filter(
250             project_participant__slug=self.kwargs['slug']
251         )
252         kwargs['users__queryset'] = qs
253         kwargs['project'] = self.project
254         return kwargs
255 
256     @functional.cached_property
257     def project(self):
258         return project_models.Project.objects.get(
259             slug=self.kwargs['slug']
260         )
261 
262     def get_context_data(self, **kwargs):
263         context = super().get_context_data(**kwargs)
264         context['project'] = self.project
265         return context
266 
267     def get_success_url(self):
268         return self.request.path
269 
270     def form_valid(self, form):
271         form.save()
272         return super().form_valid(form)
273
```
--- 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
@@ -125,6 +125,11 @@
     success_message = _('Project succesfully created.')
     permission_required = 'euth_organisations.initiate_project'
 
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context['heading'] = _("New project based on")
+        return context
+
     def get_permission_object(self):
         return self.organisation
 
@@ -155,6 +160,11 @@
     success_message = _('Project successfully updated.')
     permission_required = 'euth_organisations.initiate_project'
 
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context['heading'] = _("Update project: " + self.object.name)
+        return context
+
     def get_permission_object(self):
         return self.organisation

{"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@@ -125,6 +125,11 @@\n     success_message = _('Project succesfully created.')\n     permission_required = 'euth_organisations.initiate_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@@ -155,6 +160,11 @@\n     success_message = _('Project successfully updated.')\n     permission_required = 'euth_organisations.initiate_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", "issue": "Name of Template visible while creating the project\nHi, when creating a project with a template it would be helpful to see the name of the project type. Maybe in the black button? \nThe author/creator currently has no idea which template s/he chose and in case s/he saves it and returns to it, it may appear helpful to know which one s/he choose. Thanks & Best\n\n![bildschirmfoto 2016-10-06 um 13 43 25](https://cloud.githubusercontent.com/assets/13625047/19151541/80ffe6b6-8bcd-11e6-8ca9-fb7e778f91fe.png)\n\n", "before_files": [{"content": "from allauth.account import views as account_views\nfrom allauth.socialaccount import views as socialaccount_views\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 euth.memberships import models as member_models\nfrom euth.organisations import models as org_models\nfrom euth.phases import models as phase_models\nfrom euth.projects import models as project_models\nfrom euth.users import models as user_models\n\nfrom . import blueprints, 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        return user.organisation_set.exclude(pk=self.organisation.pk)\n\n\nclass DashboardEmailView(DashboardBaseMixin, account_views.EmailView):\n    pass\n\n\nclass DashboardAccountView(DashboardBaseMixin,\n                           socialaccount_views.ConnectionsView):\n    pass\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\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 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\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\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    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\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\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\n    def get_permission_object(self):\n        return self.organisation\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['blueprint'] = self.blueprint\n        kwargs['organisation'] = self.organisation\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.ProjectCompleteForm\n    template_name = 'euth_dashboard/project_form.html'\n    success_message = _('Project successfully updated.')\n    permission_required = 'euth_organisations.initiate_project'\n\n    def get_permission_object(self):\n        return self.organisation\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\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        return kwargs\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\n    def get_permission_object(self):\n        return self.organisation\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\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 (name, address) in emails:\n            member_models.Invite.objects.invite(user, project, address)\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\n    def get_permission_object(self):\n        return self.organisation\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\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.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 euth.memberships import models as member_models\nfrom euth.organisations import models as org_models\nfrom euth.phases import models as phase_models\nfrom euth.projects import models as project_models\nfrom euth.users import models as user_models\n\nfrom . import blueprints, 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        return user.organisation_set.exclude(pk=self.organisation.pk)\n\n\nclass DashboardEmailView(DashboardBaseMixin, account_views.EmailView):\n    pass\n\n\nclass DashboardAccountView(DashboardBaseMixin,\n                           socialaccount_views.ConnectionsView):\n    pass\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\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 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\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\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    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\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\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\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    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['blueprint'] = self.blueprint\n        kwargs['organisation'] = self.organisation\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.ProjectCompleteForm\n    template_name = 'euth_dashboard/project_form.html'\n    success_message = _('Project successfully updated.')\n    permission_required = 'euth_organisations.initiate_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    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\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        return kwargs\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\n    def get_permission_object(self):\n        return self.organisation\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\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 (name, address) in emails:\n            member_models.Invite.objects.invite(user, project, address)\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\n    def get_permission_object(self):\n        return self.organisation\n\n    @property\n    def raise_exception(self):\n        return self.request.user.is_authenticated()\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"}]}