From 751d4d79f9b1727d852b769d43e0d7b50689f72a Mon Sep 17 00:00:00 2001 From: Ian Schneider Date: Wed, 17 Oct 2012 16:17:30 -0600 Subject: [PATCH] core adjustments for silage, mostly urls - in addition to url changes, adjust js template to use results instead of rows (as per search spec) - add map changed signal to allow hooking of indexer - add function to add bbox filter to a query - implement local_layers - remove obsolete integration test (covered in unit tests now) --- geonode/layers/models.py | 13 +++ .../layers/templates/layers/layer_search.html | 4 +- geonode/layers/tests.py | 2 +- geonode/layers/urls.py | 1 - geonode/maps/models.py | 10 +- geonode/maps/signals.py | 3 + geonode/maps/templates/maps/map_search.html | 4 +- geonode/maps/tests.py | 6 +- geonode/maps/urls.py | 1 - geonode/settings.py | 1 + geonode/smoke_tests.py | 2 +- geonode/tests/integration.py | 93 +------------------ geonode/urls.py | 3 + 13 files changed, 43 insertions(+), 100 deletions(-) create mode 100644 geonode/maps/signals.py diff --git a/geonode/layers/models.py b/geonode/layers/models.py index ed019b06821..4ce7694c3d4 100644 --- a/geonode/layers/models.py +++ b/geonode/layers/models.py @@ -271,6 +271,19 @@ def keyword_csv(self): class Meta: abstract = True + + +def add_bbox_query(q, bbox): + '''modify the queryset q to limit to the provided bbox + + bbox - 4 tuple of floats representing x0,x1,y0,y1 + returns the modified query + ''' + q = q.filter(bbox_x0__gte=bbox[0]) + q = q.filter(bbox_x1__lte=bbox[1]) + q = q.filter(bbox_y0__gte=bbox[2]) + return q.filter(bbox_y1__lte=bbox[3]) + class Layer(ResourceBase): """ diff --git a/geonode/layers/templates/layers/layer_search.html b/geonode/layers/templates/layers/layer_search.html index 34e6cb2a2b4..7f58e06a9b4 100644 --- a/geonode/layers/templates/layers/layer_search.html +++ b/geonode/layers/templates/layers/layer_search.html @@ -79,14 +79,14 @@

{% trans "Selected Data" %}

{% block extra_script %}