Commit 5e2a6943 authored by Emmanuel René Huchim Puc's avatar Emmanuel René Huchim Puc

Merge branch 'dev' of gitlab.geoint.mx:mario.chirinos/GeoInt_SIDT into dev

parents da6eabd7 1632f2fa
...@@ -25,3 +25,6 @@ venv.bak/ ...@@ -25,3 +25,6 @@ venv.bak/
# pyenv # pyenv
.python-version .python-version
!**/migrations
!**/migrations/__init__.py
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -518,55 +518,6 @@ ...@@ -518,55 +518,6 @@
}); });
/*$(document).ready(function () {
var table = $('#example').DataTable
({
"ajax": data,
language:
{
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate":
{
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria":
{
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
},
responsive:
{
details:
{
type: 'column',
target: 'tr'
}
},
columnDefs:
[{
className: 'control',
orderable: false,
targets: 0
}],
order: [1, 'asc']
});
});*/
// mostrar imagen al dar click en los puntos // mostrar imagen al dar click en los puntos
document.getElementById("salesChart").onclick = function (evt) { document.getElementById("salesChart").onclick = function (evt) {
......
...@@ -153,9 +153,7 @@ ...@@ -153,9 +153,7 @@
<td> <td>
<input type="checkbox" name="is_staff" value="1" <input type="checkbox" name="is_staff" value="1"
{% if not request.user.is_superuser %}disabled{% endif %} {% if not request.user.is_superuser %}disabled{% endif %}
{% if user.staff == True %}checked{% endif %} {% if user.staff == True %}checked{% endif %}>
>
</td> </td>
<td> <td>
<input type="checkbox" name="is_superuser" value="1" <input type="checkbox" name="is_superuser" value="1"
...@@ -165,9 +163,11 @@ ...@@ -165,9 +163,11 @@
<td> <td>
<button title="save" type="submit" class="btn btn-success"><i <button title="save" type="submit" class="btn btn-success"><i
class="fa fa-save"></i></button> class="fa fa-save"></i></button>
<a href="#" class="btn btn-info" title="View profile"><i {% if Viewname != "Request" %}
class="fa fa-user-circle"></i></a> <a href="{{ BASE_URL }}/users/{{ user.user_id }}" class="btn btn-info"
title="View profile"><i
class="fa fa-user-circle"></i></a>
{% endif %}
</td> </td>
</form> </form>
</tr> </tr>
......
...@@ -161,7 +161,7 @@ def active_users(request): ...@@ -161,7 +161,7 @@ def active_users(request):
"superuser": user.is_superuser, "superuser": user.is_superuser,
}) })
# messages.success(request, 'your registration is being processed') # messages.success(request, 'your registration is being processed')
return render(request, 'users_table.html', {'users': user_list, "Viewname": "Request"}) return render(request, 'users_table.html', {'users': user_list, "Viewname": "Active Users"})
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
......
...@@ -66,7 +66,6 @@ def requestToImage(request): ...@@ -66,7 +66,6 @@ def requestToImage(request):
img_link = request.GET['value'] img_link = request.GET['value']
#print(img_link) #print(img_link)
r = requests.get(img_link, auth=("emmhp", "geoemm29"), stream=True) r = requests.get(img_link, auth=("emmhp", "geoemm29"), stream=True)
print(r.content)
img_str = base64.b64encode(r.content) img_str = base64.b64encode(r.content)
#print(img_str) #print(img_str)
img_str = img_str.decode('utf-8') img_str = img_str.decode('utf-8')
......
...@@ -19,4 +19,33 @@ body ...@@ -19,4 +19,33 @@ body
.submenu{ .submenu{
padding-right: 140px !important; padding-right: 140px !important;
}
.img-comp-container {
position: relative;
height: 550px; /*should be the same height as the images*/
}
.img-comp-img {
position: absolute;
width: auto;
height: auto;
overflow:hidden;
}
.img-comp-img img {
display: block;
vertical-align: middle;
}
.img-comp-slider {
position: absolute;
z-index:9;
cursor: ew-resize;
/*set the appearance of the slider:*/
width: 40px;
height: 40px;
background-color: #2196F3;
opacity: 0.7;
border-radius: 50%;
} }
\ No newline at end of file
...@@ -13,6 +13,9 @@ var reportImg = activePoints[0]; ...@@ -13,6 +13,9 @@ var reportImg = activePoints[0];
// mostrar imagen al dar click en los puntos // mostrar imagen al dar click en los puntos
document.getElementById("myChart").onclick = function (evt) { document.getElementById("myChart").onclick = function (evt) {
if (slider != false) {
deleteComparisons()
}
stop(); stop();
console.log("on click") console.log("on click")
...@@ -24,13 +27,14 @@ document.getElementById("myChart").onclick = function (evt) { ...@@ -24,13 +27,14 @@ document.getElementById("myChart").onclick = function (evt) {
console.log(activePoint) console.log(activePoint)
console.log(activePoint.length) console.log(activePoint.length)
if(activePoint.length>0){ if(activePoint.length>0){
console.log("asd")
var firstPoint = activePoint[0]; var firstPoint = activePoint[0];
//console.log(firstPoint) //console.log(firstPoint)
//console.log(firstPoint._datasetIndex) //la clase a la que pertenece (vegetación, agua, etc.) //console.log(firstPoint._datasetIndex) //indice de la clase a la que pertenece (vegetación, agua, etc.)
var label = myChart.data.labels[firstPoint._index]; var label = myChart.data.labels[firstPoint._index];
//console.log(label) console.log("label: ")
console.log(label)
//console.log(myChart.legend.legendItems[firstPoint._datasetIndex].text) //nombre de la capa a la que pertenece (vegetación, agua, etc.)
//if (!firstPoint) return; //if (!firstPoint) return;
activePoints.forEach(function (value, index) { activePoints.forEach(function (value, index) {
//if(value==firstPoint){ //if(value==firstPoint){
...@@ -40,6 +44,8 @@ document.getElementById("myChart").onclick = function (evt) { ...@@ -40,6 +44,8 @@ document.getElementById("myChart").onclick = function (evt) {
}); });
var imagePoint = activePoints[imageNumber]; var imagePoint = activePoints[imageNumber];
oldLabel = label.slice(0, 4) + "/" + label.slice(4, 6) + "/" + label.slice(6);
document.getElementById("satImageSecond").src = "../../static/reports/tmpImages/repsat_test_dev/" + image_path + label + "_TCI_60m.jpg"
updateImage(imagePoint); updateImage(imagePoint);
//updateImage(firstPoint); //updateImage(firstPoint);
//alert("{{ IMAGE_PATH }}"+label+"_TCI_60m.jpg"); //alert("{{ IMAGE_PATH }}"+label+"_TCI_60m.jpg");
...@@ -55,7 +61,11 @@ function play() { ...@@ -55,7 +61,11 @@ function play() {
$("#stop").show(); $("#stop").show();
// $(".next").hide(); // $(".next").hide();
// $(".prev").hide(); // $(".prev").hide();
// $("#showImage").addClass('col-lg-offset-1'); // $("#showImage").addClass('col-lg-offset-1');
if (slider == false) {
document.getElementById("titleMap").innerHTML = oldLabel + " vs " + oldLabel;
initComparisons()
}
playImages = setInterval(function () { next(); }, 4000); playImages = setInterval(function () { next(); }, 4000);
} }
...@@ -118,9 +128,27 @@ function updateImage(imagePoint) { ...@@ -118,9 +128,27 @@ function updateImage(imagePoint) {
label = imagePoint; label = imagePoint;
reportImg = imagePoint; reportImg = imagePoint;
titleLabel = label.slice(0, 4) + "/" + label.slice(4, 6) + "/" + label.slice(6); titleLabel = label.slice(0, 4) + "/" + label.slice(4, 6) + "/" + label.slice(6);
document.getElementById("titleMap").innerHTML = titleLabel; if (slider != false) {
document.getElementById("titleMap").innerHTML = oldLabel + " vs " + titleLabel;
}else{
document.getElementById("titleMap").innerHTML = titleLabel;
}
document.getElementById("satImage").src = "../../static/reports/tmpImages/repsat_test_dev/" + image_path + label + "_TCI_60m.jpg" document.getElementById("satImage").src = "../../static/reports/tmpImages/repsat_test_dev/" + image_path + label + "_TCI_60m.jpg"
document.getElementById("scl_Vegetation").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_vegetation.png"
document.getElementById("scl_saturated").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_saturated.png"
document.getElementById("scl_shadows").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_shadows.png"
document.getElementById("scl_cloud_shadows").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_cloud_shadows.png"
document.getElementById("scl_vegetation").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_vegetation.png"
document.getElementById("scl_not-vegetated").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_not-vegetated.png"
document.getElementById("scl_water").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_water.png"
document.getElementById("scl_unclassified").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_unclassified.png"
document.getElementById("scl_cloud_medium_probability").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_cloud_medium_probability.png"
document.getElementById("scl_cloud_high_probability").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_cloud_high_probability.png"
document.getElementById("scl_thin_cirrus").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_thin_cirrus.png"
document.getElementById("scl_snow").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_snow.png"
//document.getElementById("scl_vegetation").src = "../../static/reports/tmpImages/repsat_test_dev/" + scl_path + label + "_SCL_60m_vegetation.png"
} }
function change(newType) { function change(newType) {
...@@ -142,4 +170,104 @@ function change(newType) { ...@@ -142,4 +170,104 @@ function change(newType) {
} }
myChart = new Chart(ctx, temp); myChart = new Chart(ctx, temp);
}; };
\ No newline at end of file
let img, imgWidth=0, slider=false, clicked=0;
function initComparisons() {
$("#showSecondImage").show()
setTimeout(function() {
img = document.getElementsByClassName("img-comp-overlay")[0];
compareImages(img);
});
// setTimeout(function(){
// img = document.getElementsByClassName("img-comp-overlay")[0];
// compareImages(img);
// }, 200);
}
function compareImages(img) {
var imgHeight;
/*get the width and height of the img element*/
imgWidth = document.getElementById("showImage").offsetWidth;
imgHeight = img.offsetHeight;
/*set the width of the img element to 50%:*/
img.style.width = ((imgWidth / 2)) + 15 + "px";
/*create slider:*/
slider = document.createElement("DIV");
slider.setAttribute("class", "img-comp-slider col-lg-offset-1 col-md-offset-1 col-xs-offset-2");
/*insert slider*/
img.parentElement.insertBefore(slider, img);
/*position the slider in the middle:*/
slider.style.top = (imgHeight / 2) - (slider.offsetHeight / 2) + "px";
slider.style.left = ((imgWidth / 2) - (slider.offsetWidth / 2)) + 15 + "px";
/*execute a function when the mouse button is pressed:*/
slider.addEventListener("mousedown", slideReady);
/*and another function when the mouse button is released:*/
window.addEventListener("mouseup", slideFinish);
/*or touched (for touch screens:*/
slider.addEventListener("touchstart", slideReady);
/*and released (for touch screens:*/
window.addEventListener("touchstop", slideFinish);
}
function slideReady(e) {
/*prevent any other actions that may occur when moving over the image:*/
e.preventDefault();
/*the slider is now clicked and ready to move:*/
clicked = 1;
/*execute a function when the slider is moved:*/
window.addEventListener("mousemove", slideMove);
window.addEventListener("touchmove", slideMove);
}
function slideFinish() {
/*the slider is no longer clicked:*/
clicked = 0;
}
function slideMove(e) {
var pos;
/*if the slider is no longer clicked, exit this function:*/
if (clicked == 0) return false;
/*get the cursor's x position:*/
pos = getCursorPos(e)
/*prevent the slider from being positioned outside the image:*/
if (pos < 0) pos = 0;
if (pos > imgWidth) pos = imgWidth;
/*execute a function that will resize the overlay image according to the cursor:*/
slide(pos);
}
function getCursorPos(e) {
var a, x = 0;
e = e || window.event;
/*get the x positions of the image:*/
a = img.getBoundingClientRect();
/*calculate the cursor's x coordinate, relative to the image:*/
x = e.pageX - a.left;
/*consider any page scrolling:*/
x = x - window.pageXOffset;
return x;
}
function slide(x) {
/*resize the image:*/
img.style.width = x + "px";
/*position the slider:*/
slider.style.left = img.offsetWidth - (slider.offsetWidth / 2) + "px";
}
function deleteComparisons(){
slider.removeEventListener("mousedown", slideReady);
slider.removeEventListener("touchstart", slideReady);
window.removeEventListener("mouseup", slideFinish) ;
window.removeEventListener("touchstop", slideFinish);
window.removeEventListener("mousemove", slideMove);
window.removeEventListener("touchmove", slideMove);
$(".img-comp-slider").remove();
$("#showSecondImage").hide()
slider= false;
}
//deleteComparisons();
//initComparisons();
\ No newline at end of file
This diff is collapsed.
...@@ -5,15 +5,18 @@ ...@@ -5,15 +5,18 @@
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css"> <link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css"
type="text/css">
<style> <style>
.map { .map {
height: 400px; height: 400px;
width: 100%; width: 100%;
} }
</style> </style>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script> <script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
<link rel="stylesheet" href="https://openlayers.org/en/v5.3.0/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
{% endblock %} {% endblock %}
{% block messages %} {% block messages %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
...@@ -65,7 +68,7 @@ ...@@ -65,7 +68,7 @@
<li> <li>
<!-- inner menu: contains the actual data --> <!-- inner menu: contains the actual data -->
<ul class="menu"> <ul class="menu">
<li> <li>
<a href="#"> <a href="#">
<i class="fa fa-productList text-aqua"></i> 5 new members joined today <i class="fa fa-productList text-aqua"></i> 5 new members joined today
</a> </a>
...@@ -156,7 +159,7 @@ ...@@ -156,7 +159,7 @@
{% for product in productList %} {% for product in productList %}
<tr> <tr>
<td><a href="#" <td><a href="#"
onclick="showMyModalSetTitle('{{ product.search_name }}', 'Some body txt')"> {{ product.search_name }}</a> onclick="showMyModalSetTitle('{{ product.search_name }}','{{ product.polygon }}');"> {{ product.search_name }}</a>
</td> </td>
<td>{{ product.process }}</td> <td>{{ product.process }}</td>
<td>{{ product.purchase_date }}</td> <td>{{ product.purchase_date }}</td>
...@@ -271,14 +274,21 @@ ...@@ -271,14 +274,21 @@
function showMyModalSetTitle(name,data) { function showMyModalSetTitle(name,data) {
$('#map').empty(); $('#map').empty();
$('#myModalTitle').val(name); $('#myModalTitle').empty();
$('#myModalTitle').append(name);
$("#mapmodal").modal(); $("#mapmodal").modal();
setTimeout(function(){ createmap(); }, 1000);
setTimeout(function () {
createmap(data);
}, 1000);
//console.log(data)
} }
function createmap() {
var map = new ol.Map({ function createmap(data) {
/*var map = new ol.Map({
target: 'map', target: 'map',
layers: [ layers: [
new ol.layer.Tile({ new ol.layer.Tile({
...@@ -286,10 +296,40 @@ ...@@ -286,10 +296,40 @@
}) })
], ],
view: new ol.View({ view: new ol.View({
center: ol.proj.fromLonLat([-89.63873079999999,21.0404457]), center: ol.proj.fromLonLat([-89.63873079999999, 21.0404457]),
zoom: 5 zoom: 5
}) })
});*/
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
var format = new ol.format.WKT();
var feature = format.readFeature(data);
feature.getGeometry().transform('EPSG:4326', 'EPSG:3857');
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
features: [feature]
})
}); });
var center = feature.getGeometry();
var map = new ol.Map({
controls: [],
interactions: [],
layers: [raster, vector],
target: 'map',
view: new ol.View({
center: [center.getInteriorPoint().getFirstCoordinate()[0], center.getInteriorPoint().getFirstCoordinate()[1]],
zoom: 9
})
});
} }
</script> </script>
{% endblock %} {% endblock %}
...@@ -76,8 +76,8 @@ def report_L2ASCL(request, report, purchase_id): ...@@ -76,8 +76,8 @@ def report_L2ASCL(request, report, purchase_id):
labelNames = [ labelNames = [
"No Data", "Saturated", "Shadows", "Cloud Shadows", "Vegetation", "No Data", "Saturated", "Shadows", "Cloud Shadows", "Vegetation",
"Not-Vegetated", "Water", "Unclassified", "Cloud Medium Probablilty", "Not-Vegetated", "Water", "Unclassified", "Cloud Medium Probability",
"Cloud Hight Probablilty", "Thin Cirrus", "Snow" "Cloud High Probability", "Thin Cirrus", "Snow"
] ]
colors = [ colors = [
...@@ -174,11 +174,13 @@ def Reports(request): ...@@ -174,11 +174,13 @@ def Reports(request):
#"../ static / reports / tmpImages / repsat_test_dev / umorales @ centrogeo.edu.mx / "+str(producto['id']) / myzip.zip" #"../ static / reports / tmpImages / repsat_test_dev / umorales @ centrogeo.edu.mx / "+str(producto['id']) / myzip.zip"
wkt = USERS_PATH + request.user.email + "/" + str(producto['id']) + "/findProducts.json"
with open(wkt, 'r') as jsonfile:
polygon = json.load(jsonfile)
for file in os.listdir(path=zip_path): for file in os.listdir(path=zip_path):
if file.endswith(".zip"): if file.endswith(".zip"):
print(file)
zip = zip_path+"/"+file zip = zip_path+"/"+file
print(zip)
productList.append({ productList.append({
"search_name": producto['search__search_name'], "search_name": producto['search__search_name'],
"process": producto['search__process_id__name'], "process": producto['search__process_id__name'],
...@@ -192,6 +194,7 @@ def Reports(request): ...@@ -192,6 +194,7 @@ def Reports(request):
"log_info": log, "log_info": log,
"initial_folder" :initial_folder, "initial_folder" :initial_folder,
"zip" : zip, "zip" : zip,
"polygon": polygon['wkt'],
}) })
size = 0 size = 0
final_size = 0 final_size = 0
...@@ -199,6 +202,7 @@ def Reports(request): ...@@ -199,6 +202,7 @@ def Reports(request):
progress = 0 progress = 0
initial_folder = "" initial_folder = ""
zip ="" zip =""
wkt =""
return render(request, 'Reports.html', {"productList": productList}) return render(request, 'Reports.html', {"productList": productList})
...@@ -232,9 +236,9 @@ def wsProcessProgress(request): ...@@ -232,9 +236,9 @@ def wsProcessProgress(request):
if 'Finalizing...' in open(log_info).read(): if 'Finalizing...' in open(log_info).read():
progress = 100 progress = 100
item = Purchase.objects.get(pk=producto['id']) #item = Purchase.objects.get(pk=producto['id'])
item.progress = progress #item.progress = progress
item.save() #item.save()
productList2.append({ productList2.append({
"purchase_id": producto['id'], "purchase_id": producto['id'],
......
...@@ -137,15 +137,16 @@ ...@@ -137,15 +137,16 @@
<div class="nav-tabs-custom"> <div class="nav-tabs-custom">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="#activity" data-toggle="tab">Activity</a></li> <li class="active"><a href="#activity" data-toggle="tab">Activity</a></li>
<li><a href="#timeline" data-toggle="tab">Timeline</a></li> <!--li><a href="#timeline" data-toggle="tab">Timeline</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li> <li><a href="#settings" data-toggle="tab">Settings</a></li-->
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="active tab-pane" id="activity"> <div class="active tab-pane" id="activity">
<!-- Post --> <!-- Post -->
<div class="post"> <div class="post">
<div class="user-block"> <div class="user-block">
<img class="img-circle img-bordered-sm" src="../../dist/img/user1-128x128.jpg" <img class="img-circle img-bordered-sm"
src="{% static 'users/images/user_default.png' %}"
alt="user image"> alt="user image">
<span class="username"> <span class="username">
<a href="#">Jonathan Burke Jr.</a> <a href="#">Jonathan Burke Jr.</a>
...@@ -165,59 +166,7 @@ ...@@ -165,59 +166,7 @@
</div> </div>
<!-- /.post --> <!-- /.post -->
<!-- Post -->
<div class="post">
<div class="user-block">
<img class="img-circle img-bordered-sm" src="../../dist/img/user6-128x128.jpg"
alt="User Image">
<span class="username">
<a href="#">Adam Jones</a>
<a href="#" class="pull-right btn-box-tool"><i class="fa fa-times"></i></a>
</span>
<span class="description">Posted 5 photos - 5 days ago</span>
</div>
<!-- /.user-block -->
<div class="row margin-bottom">
<div class="col-sm-6">
<img class="img-responsive" src="../../dist/img/photo1.png" alt="Photo">
</div>
<!-- /.col -->
<div class="col-sm-6">
<div class="row">
<div class="col-sm-6">
<img class="img-responsive" src="../../dist/img/photo2.png" alt="Photo">
<br>
<img class="img-responsive" src="../../dist/img/photo3.jpg" alt="Photo">
</div>
<!-- /.col -->
<div class="col-sm-6">
<img class="img-responsive" src="../../dist/img/photo4.jpg" alt="Photo">
<br>
<img class="img-responsive" src="../../dist/img/photo1.png" alt="Photo">
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<!--ul class="list-inline">
<li><a href="#" class="link-black text-sm"><i class="fa fa-share margin-r-5"></i>
Share</a></li>
<li><a href="#" class="link-black text-sm"><i
class="fa fa-thumbs-o-up margin-r-5"></i> Like</a>
</li>
<li class="pull-right">
<a href="#" class="link-black text-sm"><i
class="fa fa-comments-o margin-r-5"></i> Comments
(5)</a></li>
</ul-->
<!--input class="form-control input-sm" type="text" placeholder="Type a comment"-->
</div>
<!-- /.post -->
</div> </div>
<!-- /.tab-pane --> <!-- /.tab-pane -->
<div class="tab-pane" id="timeline"> <div class="tab-pane" id="timeline">
......
{% load staticfiles %} {% load staticfiles %}
<div class="col-md-3"> {% for data in user_data %}
<!-- Profile Image --> <div class="col-md-3">
<div class="box box-primary"> <!-- Profile Image -->
<div class="box-body box-profile"> <div class="box box-primary">
<img class="profile-user-img img-responsive img-circle" src="{% static 'users/images/user_default.png' %}" <div class="box-body box-profile">
alt="User profile picture"> <img class="profile-user-img img-responsive img-circle"
src="{% static 'users/images/user_default.png' %}"
alt="User profile picture">
<h3 class="profile-username text-center">{{ data.user_fullname }}</h3>
<h3 class="profile-username text-center">{{ user.get_full_name }}</h3> <p class="text-muted text-center">Software Engineer</p>
<p class="text-muted text-center">Software Engineer</p> <ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b>Searches</b> <a class="pull-right">{{ data.searches }}</a>
</li>
<li class="list-group-item">
<b>Purchases</b> <a class="pull-right">{{ data.purchases }}</a>
</li>
<li class="list-group-item">
<b>In Process</b> <a class="pull-right">{{ data.in_process }}</a>
</li>
</ul>
<ul class="list-group list-group-unbordered"> <!--a href="#" class="btn btn-primary btn-block"><b>Follow</b></a-->
<li class="list-group-item"> </div>
<b>Searches</b> <a class="pull-right">1,322</a> <!-- /.box-body -->
</li>
<li class="list-group-item">
<b>Purchases</b> <a class="pull-right">543</a>
</li>
<li class="list-group-item">
<b>In Process</b> <a class="pull-right">13,287</a>
</li>
</ul>
<!--a href="#" class="btn btn-primary btn-block"><b>Follow</b></a-->
</div> </div>
<!-- /.box-body --> <!-- /.box -->
</div> <div>
<!-- /.box --> <br>
<div>
<br>
</div>
<!-- About Me Box -->
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">About Me</h3>
</div> </div>
<!-- /.box-header --> <!-- About Me Box -->
<div class="box-body"> <div class="box box-primary">
<strong><i class="fa fa-book margin-r-5"></i> Education</strong> <div class="box-header with-border">
<h3 class="box-title">About Me</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<strong><i class="fa fa-book margin-r-5"></i> Education</strong>
<p class="text-muted"> <p class="text-muted">
B.S. in Computer Science from the University of Tennessee at Knoxville B.S. in Computer Science from the University of Tennessee at Knoxville
</p> </p>
<hr> <hr>
<strong><i class="fa fa-map-marker margin-r-5"></i> Location</strong> <strong><i class="fa fa-map-marker margin-r-5"></i> Location</strong>
<p class="text-muted">Malibu, California</p> <p class="text-muted">Malibu, California</p>
<hr> <hr>
<strong><i class="fa fa-pencil margin-r-5"></i> Skills</strong> <strong><i class="fa fa-pencil margin-r-5"></i> Skills</strong>
<p> <p>
<span class="label label-danger">UI Design</span> <span class="label label-danger">UI Design</span>
<span class="label label-success">Coding</span> <span class="label label-success">Coding</span>
<span class="label label-info">Javascript</span> <span class="label label-info">Javascript</span>
<span class="label label-warning">PHP</span> <span class="label label-warning">PHP</span>
<span class="label label-primary">Node.js</span> <span class="label label-primary">Node.js</span>
</p> </p>
<hr> <hr>
<strong><i class="fa fa-file-text-o margin-r-5"></i> Notes</strong> <strong><i class="fa fa-file-text-o margin-r-5"></i> Notes</strong>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam fermentum enim neque.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam fermentum enim neque.</p>
</div>
<!-- /.box-body -->
</div> </div>
<!-- /.box-body --> <!-- /.box -->
</div> </div>
<!-- /.box --> {% endfor %}
</div> \ No newline at end of file
\ No newline at end of file
<div class="form-group"> <div class="form-group">
<br> <br>
<!--ul class="sidebar-menu" data-widget="tree"> <ul class="sidebar-menu" data-widget="tree">
<li> <li>
<a class="treeview " href="{{ BASE_URL }}/administration"> <a class="treeview " href="{{ BASE_URL }}/reports">
<i class="fa fa-home"></i> <i class="fa fa-files-o"></i>
<span>Dashboard</span> <span>Reports</span>
<span class="pull-right-container"> <span class="pull-right-container">
<span class="label label-primary pull-right"></span> <span class="label label-primary pull-right"></span>
</span> </span>
</a> </a>
</li> </li>
<li> <!--li>
<a class="treeview " href="../../administration/request"> <a class="treeview " href="{{ BASE_URL }}/administration/request">
<i class="fa fa-user-plus"></i> <i class="fa fa-user-plus"></i>
<span>Request</span> <span>Request</span>
<span class="pull-right-container"> <span class="pull-right-container">
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
<span class="label label-primary pull-right"></span> <span class="label label-primary pull-right"></span>
</span> </span>
</a> </a>
</li> </li-->
</ul--> </ul>
</div> </div>
\ No newline at end of file
...@@ -25,5 +25,6 @@ from users import views ...@@ -25,5 +25,6 @@ from users import views
urlpatterns = [ urlpatterns = [
url(r'^$', views.Users, name='users'), url(r'^$', views.Users, name='users'),
url(r'^(?P<user_id>(\d+))/$', views.User_id, name='user_id'),
] ]
# + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) # + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.contrib.auth.models import User
from django.shortcuts import render from django.shortcuts import render
# Create your views here. # Create your views here.
from catalog.models import Search, Purchase
def Users(request): def Users(request):
user_data = []
user_statics = []
user = User.objects.get(pk=request.user.id)
searches = Search.objects.filter(user_id=user.id)
purchases = Purchase.objects.filter(user_id=user.id)
in_process = Purchase.objects.filter(user_id=user.id).exclude(progress=100)
user_data.append({
"user_fullname": user.first_name+" "+user.last_name,
"searches": searches.count(),
"purchases": purchases.count(),
"in_process": in_process.count(),
})
user_statics.append({
"user_fullname": user.first_name + " " + user.last_name,
"searches": searches.count(),
"purchases": purchases.count(),
"in_process": in_process.count(),
})
return render(request,'User_profile.html',{"user_data" : user_data} )
#----------------------------------------------------------------------
def User_id(request,user_id):
user_data = []
user = User.objects.get(pk=user_id)
searches = Search.objects.filter(user_id=user.id)
purchases = Purchase.objects.filter(user_id=user.id).order_by('aggreg_date')
in_process = Purchase.objects.filter(user_id=user.id).exclude(progress=100)
user_data.append({
"user_fullname": user.first_name+" "+user.last_name,
"searches": searches.count(),
"purchases": purchases.count(),
"in_process": in_process.count(),
})
return render(request,'User_profile.html') return render(request,'User_profile.html',{"user_data" : user_data} )
\ No newline at end of file \ No newline at end of file
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