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):
def get_context_data(self, **kwargs):
context = super(AddForm, self).get_context_data(**kwargs)
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)
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)
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)
context['stats'] = [
(_('Total confirmed reports'), len([i for i,z in reports if i>0])),
......@@ -224,7 +224,7 @@ class ViolationsList(ListView):
queryset = Violation.objects.filter(activationid='',
country=self.kwargs['country']).exclude(old=True)
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
def get_context_data(self, **kwargs):
......@@ -234,7 +234,7 @@ class ViolationsList(ListView):
context['country'] = self.kwargs['country']
else:
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)
countryweights=json.dumps([{'iso2': y, 'w': x} for x, y in 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