From 19c480fdbf9ad8d3b92e5b7473aeeef22b5681df Mon Sep 17 00:00:00 2001 From: crccheck Date: Mon, 4 May 2015 00:06:50 -0500 Subject: [PATCH] filter zero values from getting rendered Kicks a few thousand markers, so helps with GH #14 --- Makefile | 4 ++-- mixed_beverages/apps/lazy_geo/views.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9e602be..3e127fc 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,9 @@ clean: find . -name "*.pyc" -delete find . -name ".DS_Store" -delete -# make sure to install the hstore extension in template1 +# Note: make sure to install the hstore extension in template1 test: - ENVIRONMENT=test $(MANAGE) test + $(MANAGE) test resetdb: diff --git a/mixed_beverages/apps/lazy_geo/views.py b/mixed_beverages/apps/lazy_geo/views.py index afecadf..96a826b 100644 --- a/mixed_beverages/apps/lazy_geo/views.py +++ b/mixed_beverages/apps/lazy_geo/views.py @@ -2,6 +2,7 @@ from django.contrib.admin.views.decorators import staff_member_required from django.core.urlresolvers import reverse +from django.db.models import Q from django.http import ( HttpResponseBadRequest, JsonResponse, HttpResponseRedirect, HttpResponseForbidden, @@ -37,7 +38,8 @@ def get(self, request, *args, **kwargs): class MarkerList(GeoJSONLayerView): - queryset = models.Location.objects.exclude(coordinate=None) + queryset = models.Location.objects.filter(coordinate__isnull=False).exclude( + Q(data__avg_tax='0') | Q(data__avg_tax='0.00')) geometry_field = 'coordinate' precision = 6 properties = ('coordinate_quality', 'data',)