Skip to content

Commit eec2d5f

Browse files
committed
Fix #428
1 parent 5ea5784 commit eec2d5f

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

coldfront/core/allocation/views.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,7 @@ def post(self, request, *args, **kwargs):
22042204
allocation_attributes_to_change = self.get_allocation_attributes_to_change(
22052205
allocation_obj)
22062206

2207+
# TODO: this logic is a mess. Needs to be cleaned up
22072208
if allocation_attributes_to_change:
22082209
formset = formset_factory(self.formset_class, max_num=len(
22092210
allocation_attributes_to_change))
@@ -2213,7 +2214,8 @@ def post(self, request, *args, **kwargs):
22132214
if form.is_valid() and formset.is_valid():
22142215
form_data = form.cleaned_data
22152216

2216-
if form_data.get('end_date_extension') != 0: change_requested = True
2217+
if form_data.get('end_date_extension') != 0:
2218+
change_requested = True
22172219

22182220
for entry in formset:
22192221
formset_data = entry.cleaned_data
@@ -2307,30 +2309,29 @@ def post(self, request, *args, **kwargs):
23072309
messages.success(
23082310
request, 'Allocation change request successfully submitted.')
23092311

2310-
pi_name = '{} {} ({})'.format(allocation_obj.project.pi.first_name,
2311-
allocation_obj.project.pi.last_name, allocation_obj.project.pi.username)
2312-
resource_name = allocation_obj.get_parent_resource
2313-
domain_url = get_domain_url(self.request)
2314-
url = '{}{}'.format(domain_url, reverse('allocation-change-list'))
2312+
pi_name = '{} {} ({})'.format(allocation_obj.project.pi.first_name,
2313+
allocation_obj.project.pi.last_name, allocation_obj.project.pi.username)
2314+
resource_name = allocation_obj.get_parent_resource
2315+
domain_url = get_domain_url(self.request)
2316+
url = '{}{}'.format(domain_url, reverse('allocation-change-list'))
23152317

2316-
if EMAIL_ENABLED:
2317-
template_context = {
2318-
'pi': pi_name,
2319-
'resource': resource_name,
2320-
'url': url
2321-
}
2318+
if EMAIL_ENABLED:
2319+
template_context = {
2320+
'pi': pi_name,
2321+
'resource': resource_name,
2322+
'url': url
2323+
}
23222324

2323-
send_email_template(
2324-
'New Allocation Change Request: {} - {}'.format(
2325-
pi_name, resource_name),
2326-
'email/new_allocation_change_request.txt',
2327-
template_context,
2328-
EMAIL_SENDER,
2329-
[EMAIL_TICKET_SYSTEM_ADDRESS, ]
2330-
)
2325+
send_email_template(
2326+
'New Allocation Change Request: {} - {}'.format(
2327+
pi_name, resource_name),
2328+
'email/new_allocation_change_request.txt',
2329+
template_context,
2330+
EMAIL_SENDER,
2331+
[EMAIL_TICKET_SYSTEM_ADDRESS, ]
2332+
)
23312333

23322334
return HttpResponseRedirect(reverse('allocation-detail', kwargs={'pk': pk}))
2333-
23342335
else:
23352336
messages.error(request, 'You must request a change.')
23362337
return HttpResponseRedirect(reverse('allocation-change', kwargs={'pk': pk}))

0 commit comments

Comments
 (0)