We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Import old release notes
Add them to `docs/releases` dictionary. Get old release notes from [Piotr's blog](http://piotr.banaszkiewicz.org/).

It'd be better to keep release notes along with source code, so that they won't get lost, and to have everything in one place. @pbanaszkiewicz what's your opinion?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `extforms/views.py`
Content:
```
1 from django.conf import settings
2 from django.core.urlresolvers import reverse, reverse_lazy
3 from django.shortcuts import render
4 from django.template.loader import get_template
5 from django.views.generic import TemplateView
6 
7 from workshops.forms import (
8     SWCEventRequestForm,
9     DCEventRequestForm,
10     EventSubmitForm,
11     DCSelfOrganizedEventRequestForm,
12     TrainingRequestForm,
13     ProfileUpdateRequestForm,
14 )
15 from workshops.models import (
16     EventRequest,
17     EventSubmission as EventSubmissionModel,
18     DCSelfOrganizedEventRequest as DCSelfOrganizedEventRequestModel,
19 )
20 from workshops.util import (
21     login_not_required,
22     LoginNotRequiredMixin,
23 )
24 from workshops.base_views import (
25     AMYCreateView,
26     EmailSendMixin,
27 )
28 
29 
30 class SWCEventRequest(LoginNotRequiredMixin, EmailSendMixin, AMYCreateView):
31     model = EventRequest
32     form_class = SWCEventRequestForm
33     page_title = 'Request a Software Carpentry Workshop'
34     template_name = 'forms/workshop_swc_request.html'
35     success_url = reverse_lazy('swc_workshop_request_confirm')
36     email_fail_silently = False
37     email_kwargs = {
38         'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,
39         'reply_to': None,
40     }
41 
42     def get_success_message(self, *args, **kwargs):
43         """Don't display a success message."""
44         return ''
45 
46     def get_context_data(self, **kwargs):
47         context = super().get_context_data(**kwargs)
48         context['title'] = self.page_title
49         return context
50 
51     def get_subject(self):
52         subject = (
53             '[{tag}] New workshop request: {affiliation}, {country}'
54         ).format(
55             tag=self.object.workshop_type.upper(),
56             country=self.object.country.name,
57             affiliation=self.object.affiliation,
58         )
59         return subject
60 
61     def get_body(self):
62         link = self.object.get_absolute_url()
63         link_domain = settings.SITE_URL
64 
65         body_txt = get_template(
66             'mailing/eventrequest.txt'
67         ).render({
68             'object': self.object,
69             'link': link,
70             'link_domain': link_domain,
71         })
72 
73         body_html = get_template(
74             'mailing/eventrequest.html'
75         ).render({
76             'object': self.object,
77             'link': link,
78             'link_domain': link_domain,
79         })
80         return body_txt, body_html
81 
82     def form_valid(self, form):
83         """Send email to admins if the form is valid."""
84         data = form.cleaned_data
85         self.email_kwargs['reply_to'] = (data['email'], )
86         result = super().form_valid(form)
87         return result
88 
89 
90 class SWCEventRequestConfirm(LoginNotRequiredMixin, TemplateView):
91     """Display confirmation of received workshop request."""
92     template_name = 'forms/workshop_swc_request_confirm.html'
93 
94     def get_context_data(self, **kwargs):
95         context = super().get_context_data(**kwargs)
96         context['title'] = 'Thank you for requesting a workshop'
97         return context
98 
99 
100 class DCEventRequest(SWCEventRequest):
101     form_class = DCEventRequestForm
102     page_title = 'Request a Data Carpentry Workshop'
103     template_name = 'forms/workshop_dc_request.html'
104     success_url = reverse_lazy('dc_workshop_request_confirm')
105 
106 
107 class DCEventRequestConfirm(SWCEventRequestConfirm):
108     """Display confirmation of received workshop request."""
109     template_name = 'forms/workshop_dc_request_confirm.html'
110 
111 
112 @login_not_required
113 def profileupdaterequest_create(request):
114     """
115     Profile update request form. Accessible to all users (no login required).
116 
117     This one is used when instructors want to change their information.
118     """
119     form = ProfileUpdateRequestForm()
120     page_title = 'Update Instructor Profile'
121 
122     if request.method == 'POST':
123         form = ProfileUpdateRequestForm(request.POST)
124 
125         if form.is_valid():
126             form.save()
127 
128             # TODO: email notification?
129 
130             context = {
131                 'title': 'Thank you for updating your instructor profile',
132             }
133             return render(request,
134                           'forms/profileupdate_confirm.html',
135                           context)
136         else:
137             messages.error(request, 'Fix errors below.')
138 
139     context = {
140         'title': page_title,
141         'form': form,
142     }
143     return render(request, 'forms/profileupdate.html', context)
144 
145 
146 # This form is disabled as per @maneesha's request
147 # class EventSubmission(LoginNotRequiredMixin, EmailSendMixin,
148 #                       AMYCreateView):
149 class EventSubmission(LoginNotRequiredMixin, TemplateView):
150     """Display form for submitting existing workshops."""
151     model = EventSubmissionModel
152     form_class = EventSubmitForm
153     template_name = 'forms/event_submit.html'
154     success_url = reverse_lazy('event_submission_confirm')
155     email_fail_silently = False
156     email_kwargs = {
157         'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,
158     }
159 
160     def get_success_message(self, *args, **kwargs):
161         """Don't display a success message."""
162         return ''
163 
164     def get_context_data(self, **kwargs):
165         context = super().get_context_data(**kwargs)
166         context['title'] = 'Tell us about your workshop'
167         return context
168 
169     def get_subject(self):
170         return ('New workshop submission from {}'
171                 .format(self.object.contact_name))
172 
173     def get_body(self):
174         link = self.object.get_absolute_url()
175         link_domain = settings.SITE_URL
176         body_txt = get_template('mailing/event_submission.txt') \
177             .render({
178                 'object': self.object,
179                 'link': link,
180                 'link_domain': link_domain,
181             })
182         body_html = get_template('mailing/event_submission.html') \
183             .render({
184                 'object': self.object,
185                 'link': link,
186                 'link_domain': link_domain,
187             })
188         return body_txt, body_html
189 
190 
191 class EventSubmissionConfirm(LoginNotRequiredMixin, TemplateView):
192     """Display confirmation of received workshop submission."""
193     template_name = 'forms/event_submission_confirm.html'
194 
195     def get_context_data(self, **kwargs):
196         context = super().get_context_data(**kwargs)
197         context['title'] = 'Thanks for your submission'
198         return context
199 
200 
201 class DCSelfOrganizedEventRequest(LoginNotRequiredMixin, EmailSendMixin,
202                                   AMYCreateView):
203     "Display form for requesting self-organized workshops for Data Carpentry."
204     model = DCSelfOrganizedEventRequestModel
205     form_class = DCSelfOrganizedEventRequestForm
206     # we're reusing DC templates for normal workshop requests
207     template_name = 'forms/workshop_dc_request.html'
208     success_url = reverse_lazy('dc_workshop_selforganized_request_confirm')
209     email_fail_silently = False
210     email_kwargs = {
211         'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,
212     }
213 
214     def get_success_message(self, *args, **kwargs):
215         """Don't display a success message."""
216         return ''
217 
218     def get_context_data(self, **kwargs):
219         context = super().get_context_data(**kwargs)
220         context['title'] = 'Register a self-organized Data Carpentry workshop'
221         return context
222 
223     def get_subject(self):
224         return ('DC: new self-organized workshop request from {} @ {}'
225                 .format(self.object.name, self.object.organization))
226 
227     def get_body(self):
228         link = self.object.get_absolute_url()
229         link_domain = settings.SITE_URL
230         body_txt = get_template('mailing/dc_self_organized.txt') \
231             .render({
232                 'object': self.object,
233                 'link': link,
234                 'link_domain': link_domain,
235             })
236         body_html = get_template('mailing/dc_self_organized.html') \
237             .render({
238                 'object': self.object,
239                 'link': link,
240                 'link_domain': link_domain,
241             })
242         return body_txt, body_html
243 
244 
245 class DCSelfOrganizedEventRequestConfirm(LoginNotRequiredMixin, TemplateView):
246     """Display confirmation of a received self-organized workshop request."""
247     # we're reusing DC templates for normal workshop requests
248     template_name = 'forms/workshop_dc_request_confirm.html'
249 
250     def get_context_data(self, **kwargs):
251         context = super().get_context_data(**kwargs)
252         context['title'] = 'Thanks for your submission'
253         return context
254 
255 
256 @login_not_required
257 def trainingrequest_create(request):
258     """A form to let all users (no login required) to request Instructor
259     Training."""
260 
261     form = TrainingRequestForm()
262     page_title = 'Apply for Instructor Training'
263 
264     if request.method == 'POST':
265         form = TrainingRequestForm(request.POST)
266 
267         if form.is_valid():
268             form.save()
269 
270             # TODO: email notification?
271 
272             context = {
273                 'title': 'Thank you for applying for an instructor training.',
274             }
275             return render(request,
276                           'forms/trainingrequest_confirm.html',
277                           context)
278         else:
279             messages.error(request, 'Fix errors below.')
280 
281     context = {
282         'title': page_title,
283         'form': form,
284     }
285     return render(request, 'forms/trainingrequest.html', context)
286
```
--- 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/extforms/views.py b/extforms/views.py
--- a/extforms/views.py
+++ b/extforms/views.py
@@ -1,5 +1,6 @@
 from django.conf import settings
-from django.core.urlresolvers import reverse, reverse_lazy
+from django.contrib import messages
+from django.core.urlresolvers import reverse_lazy
 from django.shortcuts import render
 from django.template.loader import get_template
 from django.views.generic import TemplateView

{"golden_diff": "diff --git a/extforms/views.py b/extforms/views.py\n--- a/extforms/views.py\n+++ b/extforms/views.py\n@@ -1,5 +1,6 @@\n from django.conf import settings\n-from django.core.urlresolvers import reverse, reverse_lazy\n+from django.contrib import messages\n+from django.core.urlresolvers import reverse_lazy\n from django.shortcuts import render\n from django.template.loader import get_template\n from django.views.generic import TemplateView\n", "issue": "Import old release notes\nAdd them to `docs/releases` dictionary. Get old release notes from [Piotr's blog](http://piotr.banaszkiewicz.org/).\r\n\r\nIt'd be better to keep release notes along with source code, so that they won't get lost, and to have everything in one place. @pbanaszkiewicz what's your opinion?\n", "before_files": [{"content": "from django.conf import settings\nfrom django.core.urlresolvers import reverse, reverse_lazy\nfrom django.shortcuts import render\nfrom django.template.loader import get_template\nfrom django.views.generic import TemplateView\n\nfrom workshops.forms import (\n    SWCEventRequestForm,\n    DCEventRequestForm,\n    EventSubmitForm,\n    DCSelfOrganizedEventRequestForm,\n    TrainingRequestForm,\n    ProfileUpdateRequestForm,\n)\nfrom workshops.models import (\n    EventRequest,\n    EventSubmission as EventSubmissionModel,\n    DCSelfOrganizedEventRequest as DCSelfOrganizedEventRequestModel,\n)\nfrom workshops.util import (\n    login_not_required,\n    LoginNotRequiredMixin,\n)\nfrom workshops.base_views import (\n    AMYCreateView,\n    EmailSendMixin,\n)\n\n\nclass SWCEventRequest(LoginNotRequiredMixin, EmailSendMixin, AMYCreateView):\n    model = EventRequest\n    form_class = SWCEventRequestForm\n    page_title = 'Request a Software Carpentry Workshop'\n    template_name = 'forms/workshop_swc_request.html'\n    success_url = reverse_lazy('swc_workshop_request_confirm')\n    email_fail_silently = False\n    email_kwargs = {\n        'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,\n        'reply_to': None,\n    }\n\n    def get_success_message(self, *args, **kwargs):\n        \"\"\"Don't display a success message.\"\"\"\n        return ''\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = self.page_title\n        return context\n\n    def get_subject(self):\n        subject = (\n            '[{tag}] New workshop request: {affiliation}, {country}'\n        ).format(\n            tag=self.object.workshop_type.upper(),\n            country=self.object.country.name,\n            affiliation=self.object.affiliation,\n        )\n        return subject\n\n    def get_body(self):\n        link = self.object.get_absolute_url()\n        link_domain = settings.SITE_URL\n\n        body_txt = get_template(\n            'mailing/eventrequest.txt'\n        ).render({\n            'object': self.object,\n            'link': link,\n            'link_domain': link_domain,\n        })\n\n        body_html = get_template(\n            'mailing/eventrequest.html'\n        ).render({\n            'object': self.object,\n            'link': link,\n            'link_domain': link_domain,\n        })\n        return body_txt, body_html\n\n    def form_valid(self, form):\n        \"\"\"Send email to admins if the form is valid.\"\"\"\n        data = form.cleaned_data\n        self.email_kwargs['reply_to'] = (data['email'], )\n        result = super().form_valid(form)\n        return result\n\n\nclass SWCEventRequestConfirm(LoginNotRequiredMixin, TemplateView):\n    \"\"\"Display confirmation of received workshop request.\"\"\"\n    template_name = 'forms/workshop_swc_request_confirm.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Thank you for requesting a workshop'\n        return context\n\n\nclass DCEventRequest(SWCEventRequest):\n    form_class = DCEventRequestForm\n    page_title = 'Request a Data Carpentry Workshop'\n    template_name = 'forms/workshop_dc_request.html'\n    success_url = reverse_lazy('dc_workshop_request_confirm')\n\n\nclass DCEventRequestConfirm(SWCEventRequestConfirm):\n    \"\"\"Display confirmation of received workshop request.\"\"\"\n    template_name = 'forms/workshop_dc_request_confirm.html'\n\n\n@login_not_required\ndef profileupdaterequest_create(request):\n    \"\"\"\n    Profile update request form. Accessible to all users (no login required).\n\n    This one is used when instructors want to change their information.\n    \"\"\"\n    form = ProfileUpdateRequestForm()\n    page_title = 'Update Instructor Profile'\n\n    if request.method == 'POST':\n        form = ProfileUpdateRequestForm(request.POST)\n\n        if form.is_valid():\n            form.save()\n\n            # TODO: email notification?\n\n            context = {\n                'title': 'Thank you for updating your instructor profile',\n            }\n            return render(request,\n                          'forms/profileupdate_confirm.html',\n                          context)\n        else:\n            messages.error(request, 'Fix errors below.')\n\n    context = {\n        'title': page_title,\n        'form': form,\n    }\n    return render(request, 'forms/profileupdate.html', context)\n\n\n# This form is disabled as per @maneesha's request\n# class EventSubmission(LoginNotRequiredMixin, EmailSendMixin,\n#                       AMYCreateView):\nclass EventSubmission(LoginNotRequiredMixin, TemplateView):\n    \"\"\"Display form for submitting existing workshops.\"\"\"\n    model = EventSubmissionModel\n    form_class = EventSubmitForm\n    template_name = 'forms/event_submit.html'\n    success_url = reverse_lazy('event_submission_confirm')\n    email_fail_silently = False\n    email_kwargs = {\n        'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,\n    }\n\n    def get_success_message(self, *args, **kwargs):\n        \"\"\"Don't display a success message.\"\"\"\n        return ''\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Tell us about your workshop'\n        return context\n\n    def get_subject(self):\n        return ('New workshop submission from {}'\n                .format(self.object.contact_name))\n\n    def get_body(self):\n        link = self.object.get_absolute_url()\n        link_domain = settings.SITE_URL\n        body_txt = get_template('mailing/event_submission.txt') \\\n            .render({\n                'object': self.object,\n                'link': link,\n                'link_domain': link_domain,\n            })\n        body_html = get_template('mailing/event_submission.html') \\\n            .render({\n                'object': self.object,\n                'link': link,\n                'link_domain': link_domain,\n            })\n        return body_txt, body_html\n\n\nclass EventSubmissionConfirm(LoginNotRequiredMixin, TemplateView):\n    \"\"\"Display confirmation of received workshop submission.\"\"\"\n    template_name = 'forms/event_submission_confirm.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Thanks for your submission'\n        return context\n\n\nclass DCSelfOrganizedEventRequest(LoginNotRequiredMixin, EmailSendMixin,\n                                  AMYCreateView):\n    \"Display form for requesting self-organized workshops for Data Carpentry.\"\n    model = DCSelfOrganizedEventRequestModel\n    form_class = DCSelfOrganizedEventRequestForm\n    # we're reusing DC templates for normal workshop requests\n    template_name = 'forms/workshop_dc_request.html'\n    success_url = reverse_lazy('dc_workshop_selforganized_request_confirm')\n    email_fail_silently = False\n    email_kwargs = {\n        'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,\n    }\n\n    def get_success_message(self, *args, **kwargs):\n        \"\"\"Don't display a success message.\"\"\"\n        return ''\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Register a self-organized Data Carpentry workshop'\n        return context\n\n    def get_subject(self):\n        return ('DC: new self-organized workshop request from {} @ {}'\n                .format(self.object.name, self.object.organization))\n\n    def get_body(self):\n        link = self.object.get_absolute_url()\n        link_domain = settings.SITE_URL\n        body_txt = get_template('mailing/dc_self_organized.txt') \\\n            .render({\n                'object': self.object,\n                'link': link,\n                'link_domain': link_domain,\n            })\n        body_html = get_template('mailing/dc_self_organized.html') \\\n            .render({\n                'object': self.object,\n                'link': link,\n                'link_domain': link_domain,\n            })\n        return body_txt, body_html\n\n\nclass DCSelfOrganizedEventRequestConfirm(LoginNotRequiredMixin, TemplateView):\n    \"\"\"Display confirmation of a received self-organized workshop request.\"\"\"\n    # we're reusing DC templates for normal workshop requests\n    template_name = 'forms/workshop_dc_request_confirm.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Thanks for your submission'\n        return context\n\n\n@login_not_required\ndef trainingrequest_create(request):\n    \"\"\"A form to let all users (no login required) to request Instructor\n    Training.\"\"\"\n\n    form = TrainingRequestForm()\n    page_title = 'Apply for Instructor Training'\n\n    if request.method == 'POST':\n        form = TrainingRequestForm(request.POST)\n\n        if form.is_valid():\n            form.save()\n\n            # TODO: email notification?\n\n            context = {\n                'title': 'Thank you for applying for an instructor training.',\n            }\n            return render(request,\n                          'forms/trainingrequest_confirm.html',\n                          context)\n        else:\n            messages.error(request, 'Fix errors below.')\n\n    context = {\n        'title': page_title,\n        'form': form,\n    }\n    return render(request, 'forms/trainingrequest.html', context)\n", "path": "extforms/views.py"}], "after_files": [{"content": "from django.conf import settings\nfrom django.contrib import messages\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.shortcuts import render\nfrom django.template.loader import get_template\nfrom django.views.generic import TemplateView\n\nfrom workshops.forms import (\n    SWCEventRequestForm,\n    DCEventRequestForm,\n    EventSubmitForm,\n    DCSelfOrganizedEventRequestForm,\n    TrainingRequestForm,\n    ProfileUpdateRequestForm,\n)\nfrom workshops.models import (\n    EventRequest,\n    EventSubmission as EventSubmissionModel,\n    DCSelfOrganizedEventRequest as DCSelfOrganizedEventRequestModel,\n)\nfrom workshops.util import (\n    login_not_required,\n    LoginNotRequiredMixin,\n)\nfrom workshops.base_views import (\n    AMYCreateView,\n    EmailSendMixin,\n)\n\n\nclass SWCEventRequest(LoginNotRequiredMixin, EmailSendMixin, AMYCreateView):\n    model = EventRequest\n    form_class = SWCEventRequestForm\n    page_title = 'Request a Software Carpentry Workshop'\n    template_name = 'forms/workshop_swc_request.html'\n    success_url = reverse_lazy('swc_workshop_request_confirm')\n    email_fail_silently = False\n    email_kwargs = {\n        'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,\n        'reply_to': None,\n    }\n\n    def get_success_message(self, *args, **kwargs):\n        \"\"\"Don't display a success message.\"\"\"\n        return ''\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = self.page_title\n        return context\n\n    def get_subject(self):\n        subject = (\n            '[{tag}] New workshop request: {affiliation}, {country}'\n        ).format(\n            tag=self.object.workshop_type.upper(),\n            country=self.object.country.name,\n            affiliation=self.object.affiliation,\n        )\n        return subject\n\n    def get_body(self):\n        link = self.object.get_absolute_url()\n        link_domain = settings.SITE_URL\n\n        body_txt = get_template(\n            'mailing/eventrequest.txt'\n        ).render({\n            'object': self.object,\n            'link': link,\n            'link_domain': link_domain,\n        })\n\n        body_html = get_template(\n            'mailing/eventrequest.html'\n        ).render({\n            'object': self.object,\n            'link': link,\n            'link_domain': link_domain,\n        })\n        return body_txt, body_html\n\n    def form_valid(self, form):\n        \"\"\"Send email to admins if the form is valid.\"\"\"\n        data = form.cleaned_data\n        self.email_kwargs['reply_to'] = (data['email'], )\n        result = super().form_valid(form)\n        return result\n\n\nclass SWCEventRequestConfirm(LoginNotRequiredMixin, TemplateView):\n    \"\"\"Display confirmation of received workshop request.\"\"\"\n    template_name = 'forms/workshop_swc_request_confirm.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Thank you for requesting a workshop'\n        return context\n\n\nclass DCEventRequest(SWCEventRequest):\n    form_class = DCEventRequestForm\n    page_title = 'Request a Data Carpentry Workshop'\n    template_name = 'forms/workshop_dc_request.html'\n    success_url = reverse_lazy('dc_workshop_request_confirm')\n\n\nclass DCEventRequestConfirm(SWCEventRequestConfirm):\n    \"\"\"Display confirmation of received workshop request.\"\"\"\n    template_name = 'forms/workshop_dc_request_confirm.html'\n\n\n@login_not_required\ndef profileupdaterequest_create(request):\n    \"\"\"\n    Profile update request form. Accessible to all users (no login required).\n\n    This one is used when instructors want to change their information.\n    \"\"\"\n    form = ProfileUpdateRequestForm()\n    page_title = 'Update Instructor Profile'\n\n    if request.method == 'POST':\n        form = ProfileUpdateRequestForm(request.POST)\n\n        if form.is_valid():\n            form.save()\n\n            # TODO: email notification?\n\n            context = {\n                'title': 'Thank you for updating your instructor profile',\n            }\n            return render(request,\n                          'forms/profileupdate_confirm.html',\n                          context)\n        else:\n            messages.error(request, 'Fix errors below.')\n\n    context = {\n        'title': page_title,\n        'form': form,\n    }\n    return render(request, 'forms/profileupdate.html', context)\n\n\n# This form is disabled as per @maneesha's request\n# class EventSubmission(LoginNotRequiredMixin, EmailSendMixin,\n#                       AMYCreateView):\nclass EventSubmission(LoginNotRequiredMixin, TemplateView):\n    \"\"\"Display form for submitting existing workshops.\"\"\"\n    model = EventSubmissionModel\n    form_class = EventSubmitForm\n    template_name = 'forms/event_submit.html'\n    success_url = reverse_lazy('event_submission_confirm')\n    email_fail_silently = False\n    email_kwargs = {\n        'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,\n    }\n\n    def get_success_message(self, *args, **kwargs):\n        \"\"\"Don't display a success message.\"\"\"\n        return ''\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Tell us about your workshop'\n        return context\n\n    def get_subject(self):\n        return ('New workshop submission from {}'\n                .format(self.object.contact_name))\n\n    def get_body(self):\n        link = self.object.get_absolute_url()\n        link_domain = settings.SITE_URL\n        body_txt = get_template('mailing/event_submission.txt') \\\n            .render({\n                'object': self.object,\n                'link': link,\n                'link_domain': link_domain,\n            })\n        body_html = get_template('mailing/event_submission.html') \\\n            .render({\n                'object': self.object,\n                'link': link,\n                'link_domain': link_domain,\n            })\n        return body_txt, body_html\n\n\nclass EventSubmissionConfirm(LoginNotRequiredMixin, TemplateView):\n    \"\"\"Display confirmation of received workshop submission.\"\"\"\n    template_name = 'forms/event_submission_confirm.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Thanks for your submission'\n        return context\n\n\nclass DCSelfOrganizedEventRequest(LoginNotRequiredMixin, EmailSendMixin,\n                                  AMYCreateView):\n    \"Display form for requesting self-organized workshops for Data Carpentry.\"\n    model = DCSelfOrganizedEventRequestModel\n    form_class = DCSelfOrganizedEventRequestForm\n    # we're reusing DC templates for normal workshop requests\n    template_name = 'forms/workshop_dc_request.html'\n    success_url = reverse_lazy('dc_workshop_selforganized_request_confirm')\n    email_fail_silently = False\n    email_kwargs = {\n        'to': settings.REQUEST_NOTIFICATIONS_RECIPIENTS,\n    }\n\n    def get_success_message(self, *args, **kwargs):\n        \"\"\"Don't display a success message.\"\"\"\n        return ''\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Register a self-organized Data Carpentry workshop'\n        return context\n\n    def get_subject(self):\n        return ('DC: new self-organized workshop request from {} @ {}'\n                .format(self.object.name, self.object.organization))\n\n    def get_body(self):\n        link = self.object.get_absolute_url()\n        link_domain = settings.SITE_URL\n        body_txt = get_template('mailing/dc_self_organized.txt') \\\n            .render({\n                'object': self.object,\n                'link': link,\n                'link_domain': link_domain,\n            })\n        body_html = get_template('mailing/dc_self_organized.html') \\\n            .render({\n                'object': self.object,\n                'link': link,\n                'link_domain': link_domain,\n            })\n        return body_txt, body_html\n\n\nclass DCSelfOrganizedEventRequestConfirm(LoginNotRequiredMixin, TemplateView):\n    \"\"\"Display confirmation of a received self-organized workshop request.\"\"\"\n    # we're reusing DC templates for normal workshop requests\n    template_name = 'forms/workshop_dc_request_confirm.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Thanks for your submission'\n        return context\n\n\n@login_not_required\ndef trainingrequest_create(request):\n    \"\"\"A form to let all users (no login required) to request Instructor\n    Training.\"\"\"\n\n    form = TrainingRequestForm()\n    page_title = 'Apply for Instructor Training'\n\n    if request.method == 'POST':\n        form = TrainingRequestForm(request.POST)\n\n        if form.is_valid():\n            form.save()\n\n            # TODO: email notification?\n\n            context = {\n                'title': 'Thank you for applying for an instructor training.',\n            }\n            return render(request,\n                          'forms/trainingrequest_confirm.html',\n                          context)\n        else:\n            messages.error(request, 'Fix errors below.')\n\n    context = {\n        'title': page_title,\n        'form': form,\n    }\n    return render(request, 'forms/trainingrequest.html', context)\n", "path": "extforms/views.py"}]}