Commit 3332e0f9 authored by cermak's avatar cermak
Browse files

[FIX] Filtering by proposal type has now merged two technical reviews (T and E status)

parent cfc1b1f9
......@@ -25,6 +25,7 @@ from pinax.notifications.models import send as notify_send
class Status(models.Model):
# DO NOT CHNAGE ORDER, ADD only to the end
('P', 'in preparation'), # user can edit proposal
('S', 'submitted'), # action by user - locked and waiting for action by UO
......@@ -91,10 +91,12 @@ def reporters(request):
return qs
class ProposalFilter(django_filters.FilterSet):
st = Status.STATUS_TYPES
st = st[:3] +(('TE', 'technical check'),)+st[5:] # hack to merge two technical checks
#owner = django_filters.filters.ChoiceFilter(choices=('mine', 'all'))
proposaltype = django_filters.ChoiceFilter(choices=Proposals.PROPOSAL_TYPE, empty_label='all proposals')
last_status = django_filters.ChoiceFilter(choices=Status.STATUS_TYPES, empty_label='all statuses')
last_status = django_filters.ChoiceFilter(method='filter_last_status', choices=st, empty_label='all statuses')
local_contacts = django_filters.ModelChoiceFilter(queryset=localcontacts) #, empty_label='all local contacts')
reporter = django_filters.ModelChoiceFilter(queryset=reporters, empty_label='all reporters')
search_all = django_filters.CharFilter(method='filter_search_all', label='search proposals')
......@@ -109,6 +111,11 @@ class ProposalFilter(django_filters.FilterSet):
elif not (self.request.user.has_perm('app.approve_panel') or self.request.user.has_perm('app.approve_board')):
def filter_last_status(self, queryset, name, value):
return queryset.filter(
def filter_search_all(self, queryset, name, value):
return queryset.filter(
Q(pid__icontains=value) | Q(name__icontains=value) | Q(proposer__contact__name__icontains=value) | Q(supervisor__name__icontains=value)
......@@ -97,7 +97,7 @@
<!-- Count item widget-->
<div class="card col-xl-4 col-md-6 col-6">
<a href="/proposals/all/?last_status=T&local_contacts={{ }}"><div class="wrapper count-title d-flex">
<a href="/proposals/all/?last_status=TE&local_contacts={{ }}"><div class="wrapper count-title d-flex">
<div class="icon"><i class="icon-padnote"></i></div>
<div class="name"><strong class="text-uppercase">Proposals</strong><span>waiting for technical review</span></div>
<div class="count-number">{{ proposals_localcontact }}</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment