Skip to content

Commit

Permalink
Merge pull request #376 from brisco17/#292-view-all-allocations
Browse files Browse the repository at this point in the history
Project Detail Page: Users can see all their allocations (regardless of status)
  • Loading branch information
aebruno authored Mar 3, 2022
2 parents 5c49007 + 6165fa4 commit 7451073
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions coldfront/core/allocation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ def get(self, request, *args, **kwargs):
}

form = AllocationUpdateForm(initial=initial_data)
if not self.request.user.is_superuser:
form.fields['is_locked'].disabled = True
form.fields['is_changeable'].disabled = True

context = self.get_context_data()
context['form'] = form
Expand Down
3 changes: 2 additions & 1 deletion coldfront/core/project/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def __init__(self, request_user, project_pk, *args, **kwargs):
project_obj = get_object_or_404(Project, pk=project_pk)

allocation_query_set = project_obj.allocation_set.filter(
status__name__in=['Active', 'New', 'Renewal Requested', ], resources__is_allocatable=True, is_locked=False)
resources__is_allocatable=True, is_locked=False).exclude(status__name__in=['Denied', 'Expired', 'Payment Declined', 'Revoked', 'Unpaid',])
print(allocation_query_set)
allocation_choices = [(allocation.id, "%s (%s) %s" % (allocation.get_parent_resource.name, allocation.get_parent_resource.resource_type.name,
allocation.description if allocation.description else '')) for allocation in allocation_query_set]
allocation_choices.insert(0, ('__select_all__', 'Select All'))
Expand Down
4 changes: 0 additions & 4 deletions coldfront/core/project/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ def get_context_data(self, **kwargs):
Q(project=self.object) &
Q(project__projectuser__user=self.request.user) &
Q(project__projectuser__status__name__in=['Active', ]) &
Q(status__name__in=['Active', 'Expired',
'New', 'Renewal Requested',
'Payment Pending', 'Payment Requested',
'Payment Declined', 'Paid','Denied']) &
Q(allocationuser__user=self.request.user) &
Q(allocationuser__status__name__in=['Active', ])
).distinct().order_by('-end_date')
Expand Down

0 comments on commit 7451073

Please sign in to comment.