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
ed1f669f
Commit
ed1f669f
authored
May 29, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
product img error
parent
c5a3ec78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
50 deletions
+98
-50
dataRetrieval.js
catalog/static/js/dataRetrieval.js
+92
-46
views.py
catalog/views.py
+6
-4
No files found.
catalog/static/js/dataRetrieval.js
View file @
ed1f669f
...
@@ -214,18 +214,16 @@ $(document).ready(function () {
...
@@ -214,18 +214,16 @@ $(document).ready(function () {
console
.
log
(
"DD: "
,
data
);
console
.
log
(
"DD: "
,
data
);
$
.
ajax
({
$
.
ajax
({
type
:
"
POS
T"
,
type
:
"
GE
T"
,
url
:
img_req_url
,
url
:
img_req_url
,
data
:
{
data
:
{
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
//
'csrfmiddlewaretoken': document.getElementsByName('csrfmiddlewaretoken')[0].value,
'value'
:
data
.
product
.
link_icon
'value'
:
data
.
product
.
link_icon
},
},
dataType
:
'text'
,
dataType
:
'text'
,
success
:
function
(
response
)
{
success
:
function
(
response
)
{
// console.log("from img response: ", response);
var
raw_img
=
response
.
toString
(
"base64"
);
}
console
.
log
(
"from img response: "
,
raw_img
);
});
var
product_html
=
'<li id="'
+
data
.
id
+
' class="hover-me">'
+
var
product_html
=
'<li id="'
+
data
.
id
+
' class="hover-me">'
+
'<a href="javascript:void(0)">'
+
'<a href="javascript:void(0)">'
+
'<i class="menu-icon glyphicon glyphicon-bookmark bg-red"></i>'
+
'<i class="menu-icon glyphicon glyphicon-bookmark bg-red"></i>'
+
...
@@ -239,7 +237,8 @@ $(document).ready(function () {
...
@@ -239,7 +237,8 @@ $(document).ready(function () {
// '<div class="col-12">'+
// '<div class="col-12">'+
'<div id="'
+
data
.
id
+
'-hover" class="item-info-view">'
+
'<div id="'
+
data
.
id
+
'-hover" class="item-info-view">'
+
'<div class="cropped-preview">'
+
'<div class="cropped-preview">'
+
'<img src="'
+
data
.
img
+
'">'
+
// '<img src="' + data.img + '">'+
'<img src="data:image/jpeg;base64, '
+
raw_img
+
'">'
+
'</div>'
+
'</div>'
+
'<div class="polygon-item-data">'
+
'<div class="polygon-item-data">'
+
'<div class="city">'
+
data
.
product
.
identifier
+
'</div>'
+
'<div class="city">'
+
data
.
product
.
identifier
+
'</div>'
+
...
@@ -269,6 +268,53 @@ $(document).ready(function () {
...
@@ -269,6 +268,53 @@ $(document).ready(function () {
'</li>'
;
'</li>'
;
$
(
'#product-list-globe'
).
append
(
product_html
);
$
(
'#product-list-globe'
).
append
(
product_html
);
}
});
// var product_html = '<li id="' + data.id + ' class="hover-me">'+
// '<a href="javascript:void(0)">'+
// '<i class="menu-icon glyphicon glyphicon-bookmark bg-red"></i>'+
// '<div class="menu-info">'+
// '<h4 class="control-sidebar-subheading">' + data.product.producttype + '_' + data.product.tileid + '</h4>'+
// '<p>' + data.product.beginposition + '</p>'+
// '</div>'+
// '</a>'+
// // '</li>'+
// // '<div id="' + data.id + '-hover" class="row">'+
// // '<div class="col-12">'+
// '<div id="' + data.id + '-hover" class="item-info-view">'+
// '<div class="cropped-preview">'+
// // '<img src="' + data.img + '">'+
// '<img src="data:image/jpeg;base64, ' + raw_img + '">'+
// '</div>'+
// '<div class="polygon-item-data">'+
// '<div class="city">' + data.product.identifier + '</div>'+
// '<p class="info">'+
// '<i class="fa fa-sync-alt"></i>'+
// '<span class="type">Size:</span><br>'+
// '<span class="data-info">' + data.product.size + '</span>'+
// '</p>'+
// '<p class="info">'+
// '<i class="fa fa-calendar-gear"></i>'+
// '<span class="type">Instrument:</span><br>'+
// '<span class="data-info">' + data.product.instrumentname + '</span>'+
// '</p>'+
// // '<p class="info">'+
// // '<i class="fa fa-cloud"></i>'+
// // '<span class="type">Cloud percentage:</span><br>'+
// // '<span class="data-info">' + data.product.cloudcoverpercentage + ' %</span>'+
// // '</p>'+
// '</div>'+
// // '<div class="button-add-del">'+
// // '<button type="button" class="btn btn-success">Add to cart</button> '+
// // '<button type="button" class="btn btn-danger">Remove</button>'+
// // '</div>'+
// '</div>'+
// // '</div>'+
// // '</div>'+
// '</li>';
//
// $('#product-list-globe').append(product_html);
});
});
}
}
}
}
...
...
catalog/views.py
View file @
ed1f669f
...
@@ -39,13 +39,15 @@ def map(request):
...
@@ -39,13 +39,15 @@ def map(request):
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
def
requestToImage
(
request
):
def
requestToImage
(
request
):
# print("REQUEST: ", request.
POST['value']
)
# print("REQUEST: ", request.
GET
)
img_link
=
request
.
POS
T
[
'value'
]
img_link
=
request
.
GE
T
[
'value'
]
# img_link = img_link[:img_link.find("/") + 2] + "emmhp:geoemm29@" + img_link[img_link.find("/") + 2:]
# img_link = img_link[:img_link.find("/") + 2] + "emmhp:geoemm29@" + img_link[img_link.find("/") + 2:]
r
=
requests
.
get
(
img_link
,
auth
=
(
"emmhp"
,
"geoemm29"
))
r
=
requests
.
get
(
img_link
,
auth
=
(
"emmhp"
,
"geoemm29"
),
stream
=
True
)
# print("RAAAW: ", r.raw.read())
return
JsonResponse
({
'img'
:
r
.
content
})
# return JsonResponse({'img': "hello"})
return
HttpResponse
(
r
.
raw
.
read
(),
content_type
=
"image/jpeg"
)
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
def
productList
(
request
):
def
productList
(
request
):
...
...
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