dashboard

parent 6a550913
......@@ -350,7 +350,7 @@
<tbody>
{% for search in search %}
<tr>
<td></td>
<td>{{ search.search_name }}</td>
<td>{{ search.count }}</td>
</tr>
{% endfor %}
......
......@@ -8,7 +8,6 @@ import json
from django.http import HttpResponse, HttpResponseRedirect, HttpRequest
from PIL import Image
# Create your views here.
from catalog.models import Purchase, Search
......@@ -41,9 +40,12 @@ def Dashboard(request):
if month['date'] == date_name:
month['quantity'] = date[1]
Searches = Search.objects.values('area').annotate(count=Count('area')).order_by('-count')[:5]
Searches = Search.objects.values('search_name').exclude(search_name='Drawn polygon').annotate(
count=Count('search_name')).order_by('-count')[:5]
return render(request, 'dashboard.html', {"Viewname": "Dashboard","Usuarios":usuarios,"Total_compras": total,"Solicitud":Request,"Descargando": in_process, "dates":month_lst, "search": Searches})
return render(request, 'dashboard.html',
{"Viewname": "Dashboard", "Usuarios": usuarios, "Total_compras": total, "Solicitud": Request,
"Descargando": in_process, "dates": month_lst, "search": Searches})
# ----------------------------------------------------------
......
......@@ -57,6 +57,7 @@ class Process(models.Model):
class Search(models.Model):
area = models.TextField(null=True)
search_name = models.TextField(default="Drawn polygon")
user = models.ForeignKey(User, on_delete=models.CASCADE)
aggreg_date = models.DateTimeField(auto_now=True) # date of product aggregation
startDate = models.DateTimeField(verbose_name='Start Date')
......
......@@ -13,7 +13,7 @@ var polygonList;
var makeRequest = function (value) {
var pol_element = document.getElementById('polygon-list');
console.log("hola");
// city request to DB
// variable req_url in map.html
$.ajax({
......@@ -172,7 +172,7 @@ function drawPolygon(element) {
// draw coordsR
osmap.addPolygon(coords);
}
})
});
}
function erase_input() {
......@@ -304,6 +304,7 @@ $('#ajax-input').focus(function () {
$('#polygon-list').click(function () {
$('#option-list').hide();
OPT_LIST_IS_HIDDEN = true;
$('#search_name').val($('#ajax-input').val());
// $('#ajax-input').value = $(this);
});
......
......@@ -139,6 +139,7 @@
<form id='product-form' role="form" method="post">
{% csrf_token %}
<input type="hidden" id="user_name" name="user_name" value={{user.get_username}}>
<input type="text" id="search_name" name="search_name">
<ul class="sidebar-menu" data-widget="tree">
<li class="treeview">
<a href="#">
......
......@@ -85,6 +85,8 @@ def productList(request):
init_date = req['start'][0][:10]
end_date = req['end'][0][:10]
clouds = req['cloudPercentage'][0]
search_name = req['search_name'][0]
print(search_name)
cloud_percentage = "[0 TO " + req['cloudPercentage'][0] + "]"
## ----- aqui llamada a api sentinel
......@@ -142,7 +144,8 @@ def productList(request):
endDate=end_date,
process=proceso, # Aquí pasar el objeto completo de Process Desbloqueo cambio de Sergio
clouds=clouds,
area=area
area=area,
search_name = search_name,
)
listSearch.save()
......
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