Skip to content

Commit

Permalink
ubccr#294: Updated Allocation Change Detail page so that only admins …
Browse files Browse the repository at this point in the history
…see the editable form fields
  • Loading branch information
brisco17 committed Dec 22, 2021
1 parent a94ccc1 commit 526f9d9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,28 @@ <h3 class="d-inline"><i class="fas fa-info-circle" aria-hidden="true"></i> Alloc
</thead>
<tbody>
{% for form in formset %}
<tr>
<td>{{form.name.value}}</td>
{% if allocation_change.status.name == 'Pending' %}
<td>{{form.value.value}}</td>
<tr>
<td>{{form.name.value}}</td>
{% if allocation_change.status.name == 'Pending' %}
<td>{{form.value.value}}</td>
{% if request.user.is_superuser %}
<td>
{{form.new_value}}
<a href="{% url 'allocation-attribute-change-delete' form.change_pk.value %}" class="float-right confirm-delete">
<i class="far fa-trash-alt fa-lg"></i>
</a>
</td>
{% else %}
{% if form.new_value.value == '' %}
<td>None</td>
{% else %}
<td>{{form.new_value.value}}</td>
{% endif %}
<td>{{form.new_value.value}}</td>
{% endif %}
</tr>
{% else %}
{% if form.new_value.value == '' %}
<td>None</td>
{% else %}
<td>{{form.new_value.value}}</td>
{% endif %}
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions coldfront/core/allocation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,8 @@ def get(self, request, *args, **kwargs):
allocation_change_form.fields['justification'].disabled = True
if allocation_change_obj.status.name != 'Pending':
allocation_change_form.fields['end_date_extension'].disabled = True
if allocation_change_obj.allocation.project.pi == self.request.user:
allocation_change_form.fields['end_date_extension'].disabled = True

note_form = AllocationChangeNoteForm(
initial={'notes': allocation_change_obj.notes})
Expand Down

0 comments on commit 526f9d9

Please sign in to comment.