Commit 8d2c1946 authored by Okhin's avatar Okhin
Browse files

Finding the last filtering part on activationid=''

parent 74fc6dfc
...@@ -194,13 +194,13 @@ class AddForm(FormView): ...@@ -194,13 +194,13 @@ class AddForm(FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(AddForm, self).get_context_data(**kwargs) context = super(AddForm, self).get_context_data(**kwargs)
reports = sorted([(i['total'],i['id']) reports = sorted([(i['total'],i['id'])
for i in Violation.objects.values('id').filter(activationid='').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))], for i in Violation.objects.values('id').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))],
reverse=True) reverse=True)
confirms = sorted([(i['total'],i['country']) confirms = sorted([(i['total'],i['country'])
for i in Violation.objects.values('country').filter(activationid='').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))], for i in Violation.objects.values('country').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))],
reverse=True) reverse=True)
operators = sorted([(i['total'],i['operator_ref__name']) operators = sorted([(i['total'],i['operator_ref__name'])
for i in Violation.objects.values('operator_ref__name').filter(activationid='').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))], for i in Violation.objects.values('operator_ref__name').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))],
reverse=True) reverse=True)
context['stats'] = [ context['stats'] = [
(_('Total confirmed reports'), len([i for i,z in reports if i>0])), (_('Total confirmed reports'), len([i for i,z in reports if i>0])),
...@@ -224,7 +224,7 @@ class ViolationsList(ListView): ...@@ -224,7 +224,7 @@ class ViolationsList(ListView):
queryset = Violation.objects.filter(activationid='', queryset = Violation.objects.filter(activationid='',
country=self.kwargs['country']).exclude(old=True) country=self.kwargs['country']).exclude(old=True)
if 'all' not in self.request.GET: if 'all' not in self.request.GET:
queryset = queryset.filter(activationid='').exclude(state__in=['duplicate', 'closed']).exclude(old=False) queryset = queryset.exclude(state__in=['ooscope', 'duplicate', 'closed']).exclude(old=False)
return queryset return queryset
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
...@@ -234,7 +234,7 @@ class ViolationsList(ListView): ...@@ -234,7 +234,7 @@ class ViolationsList(ListView):
context['country'] = self.kwargs['country'] context['country'] = self.kwargs['country']
else: else:
countries = sorted([(i['total'], i['country']) countries = sorted([(i['total'], i['country'])
for i in Violation.objects.values('country').exclude(state__in=['duplicate', 'closed']).exclude(old=True).annotate(total=Count('country'))], for i in Violation.objects.values('country').exclude(state__in=['ooscope', 'duplicate', 'closed']).exclude(old=True).annotate(total=Count('country'))],
reverse=True) reverse=True)
countryweights=json.dumps([{'iso2': y, 'w': x} for x, y in countries]) countryweights=json.dumps([{'iso2': y, 'w': x} for x, y in countries])
context['countries'] = countries context['countries'] = countries
......
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