Commit 09251807 authored by Renán Sosa Guillen's avatar Renán Sosa Guillen

prueba

parent 9f18a1d6
......@@ -121,6 +121,9 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
STATIC_URL = '/static/'
# Redirect to home URL after login (Default redirects to /accounts/profile/)
......
No preview for this file type
// Get the <datalist> and <input> elements.
var input = document.getElementById('ajax-input');
var value = input;
var dataList = document.getElementById('polygon-list');
console.log(input);
// Create a new XMLHttpRequest.
var request = new XMLHttpRequest();
// Handle state changes for the request.
request.onreadystatechange = function(response) {
if (request.readyState === 4) {
if (request.status === 200) {
// Parse the JSON
var jsonOptions = JSON.parse(request.responseText);
// Loop over the JSON array.
jsonOptions.forEach(function(item) {
// Create a new <option> element.
var option = document.createElement('option');
// Set the value using the item in the JSON array.
option.value = item;
// Add the <option> element to the <datalist>.
dataList.appendChild(option);
});
// Update the placeholder text.
input.placeholder = "Search...";
} else {
// An error occured :(
input.placeholder = "Couldn't load datalist options :(";
}
}
};
// Update the placeholder text.
input.placeholder = "Loading options...";
// Set up and make the request.
request.open('POST', 'http://localhost:8080/catalog/searchsubmit/', true);
request.send({
value: value
});
\ No newline at end of file
......@@ -195,7 +195,7 @@
<script src="{% static 'adminlte/dist/js/adminlte.min.js' %}"></script>
{% block scripts %}{% endblock %}
<script src="{% static 'js/dataRetrieval.js' %}" type="text/javascript"></script>
</body>
</html>
{% extends "base_top.html" %}
{% load static %}
{% load staticfiles %}
{% block headMedia %}
<link rel="stylesheet" href="{% static 'css/map.css'%}" type="text/css">
......@@ -123,14 +123,18 @@
<form role="form" action="{% url 'search-submit' %}" method="post" class="sidebar-form">
{% csrf_token %}
<div class="input-group">
<input type="text" name="value" class="form-control" placeholder="Search...">
<input type="text" id="ajax-input" list="polygon-list" name="value" class="form-control" placeholder="Search...">
<datalist id="polygon-list">
<option value="merida">
<option value="otro">
</datalist>
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
</button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- /search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<form role="form" target="catalogFrame" action="{% url 'productList' %}">
<ul class="sidebar-menu" data-widget="tree">
......
......@@ -51,8 +51,8 @@ def productList(request):
#-------------------------------------------------------------------------------
class SearchSubmitView(View):
# template = 'map.html'
template = 'search_submit.html'
template = 'map.html'
# template = 'search_submit.html'
state_parser = {'31': "Yucatán"}
def post(self, request):
......
No preview for this file type
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