Commit 9527aafd authored by Renán Sosa Guillen's avatar Renán Sosa Guillen

views update

parent 83128bea
...@@ -101,12 +101,14 @@ class SearchSubmitView(View): ...@@ -101,12 +101,14 @@ class SearchSubmitView(View):
def post(self, request): def post(self, request):
template = loader.get_template(self.template) template = loader.get_template(self.template)
searchValue = request.POST.get('value', '') searchValue = request.POST.get('value', '')
searchValue = self.strip_accents(searchValue).lower() searchValue = self.strip_accents(searchValue).lower()
## A simple query for Polygon objects whose name is 'searchValue' ## A simple query for Polygon objects whose name is 'searchValue'
polygonList = Polygon.objects.filter(name__startswith=searchValue) ## We exclude those polygons whose E_MUN field are NULL since at this point we're only interested
## on polygons that represent cities (Municipios).
polygonList = Polygon.objects.filter(name__startswith=searchValue).exclude(E_MUN__isnull=True)
data_list = [] data_list = []
if len(polygonList) > 0: if len(polygonList) > 0:
...@@ -136,7 +138,7 @@ def regionSearched(request): ...@@ -136,7 +138,7 @@ def regionSearched(request):
""" """
city_name = request.POST['value'] city_name = request.POST['value']
cityList = Polygon.objects.filter(name=city_name) cityList = Polygon.objects.filter(name=city_name).exclude(E_MUN__isnull=True)
if len(cityList) > 0: if len(cityList) > 0:
print cityList print cityList
......
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