Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
7a8e1ccf
Commit
7a8e1ccf
authored
May 23, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prueba
parent
a46e40a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
8 deletions
+54
-8
dataRetrieval.js
catalog/static/js/dataRetrieval.js
+1
-1
views.py
catalog/views.py
+53
-7
No files found.
catalog/static/js/dataRetrieval.js
View file @
7a8e1ccf
...
...
@@ -72,7 +72,7 @@ $(document).ready(function () {
// dataList.appendChild(option);
// });
$
(
'#ajax-input'
).
autocomplete
({
source
:
data
source
:
data
.
list
});
}
});
...
...
catalog/views.py
View file @
7a8e1ccf
...
...
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
from
django.shortcuts
import
render
from
catalog.forms
import
ASFSearchForm
from
catalog.models
import
Polygon
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
,
JsonResponse
from
django.urls
import
reverse
from
django.views.generic.base
import
View
from
django.template
import
loader
...
...
@@ -49,6 +49,52 @@ def productList(request):
return
render
(
request
,
'productList.html'
,{})
#"catalog":json[0]})
# #-------------------------------------------------------------------------------
# class SearchSubmitView(View):
# template = 'map.html'
# # template = 'search_submit.html'
# state_parser = {'31': "Yucatán"}
#
# def post(self, request):
# template = loader.get_template(self.template)
# searchValue = request.POST.get('value', '')
#
# ## A simple query for Polygon objects whose name is 'searchValue'
# polygonList = Polygon.objects.filter(name=searchValue)
#
# # data = []
# list = []
# if len(polygonList) > 0:
# for polygon in polygonList:
# polygonInfo = json.loads(polygon.json_info)
#
# # data.append({
# # 'city' : polygon.name,
# # 'state' : self.state_parser[polygonInfo['properties']['CVE_ENT']],
# # 'geojson': polygon.json_info
# # })
# list.append({
# 'city': polygonInfo['properties']['NOMGEO'],
# 'state': self.state_parser[polygonInfo['properties']['CVE_ENT']],
# 'geojson': polygonInfo
# })
#
# # context = {
# # 'searchValue': searchValue,
# # 'data': json.dumps(data, ensure_ascii=True)
# # }
#
# data = {
# 'polList': list
# }
#
# # rendered_template = template.render(context, request)
# print("DATA:", data)
# # return HttpResponse(rendered_template, content_type='application/json')
# # return HttpResponse(json.dumps(data, ensure_ascii=True), content_type='application/json')
# return JsonResponse(data)
#-------------------------------------------------------------------------------
class
SearchSubmitView
(
View
):
template
=
'map.html'
...
...
@@ -78,15 +124,15 @@ class SearchSubmitView(View):
'geojson'
:
polygonInfo
})
#
context = {
#
'searchValue': searchValue,
# 'data': json.dumps(data, ensure_ascii=True)
#
}
context
=
{
'searchValue'
:
searchValue
,
'data'
:
data
}
# rendered_template = template.render(context, request)
print
(
"DATA:"
,
data
)
# return HttpResponse(rendered_template, content_type='application/json'
)
return
HttpResponse
(
json
.
dumps
(
data
,
ensure_ascii
=
True
),
content_type
=
'application/json'
)
return
render
(
request
,
self
.
template
,
context
)
#
return HttpResponse(json.dumps(data, ensure_ascii=True), content_type='application/json')
#-------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment