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
d99fa5af
Commit
d99fa5af
authored
Mar 29, 2019
by
Irving David
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corregido que no se veian los previews en la vista del carrito de compras
parent
8506409f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
6 deletions
+27
-6
.gitignore
.gitignore
+2
-1
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+2
-2
show_cart.html
catalog/templates/show_cart.html
+2
-1
views.py
catalog/views.py
+21
-2
No files found.
.gitignore
View file @
d99fa5af
...
...
@@ -3,6 +3,7 @@
config/
geosentinel/
geosentinel
catalog/static/catalog/images/sat_preview/
db.sqlite3-journal
# django stufff
...
...
@@ -27,4 +28,4 @@ venv.bak/
.python-version
!**/migrations
!**/migrations/__init__.py
\ No newline at end of file
!**/migrations/__init__.py
catalog/static/catalog/js/dataRetrieval.js
View file @
d99fa5af
...
...
@@ -91,7 +91,7 @@ function updateCart(){
temp_2
.
content
.
querySelector
(
'h4'
).
id
=
product
.
uuid
+
"-h4"
;
temp_2
.
content
.
querySelector
(
'h4'
).
textContent
=
product
.
info
.
producttype
+
"_"
+
product
.
info
.
tileid
;
temp_2
.
content
.
querySelector
(
'p'
).
textContent
=
product
.
info
.
beginposition
;
temp_2
.
content
.
querySelector
(
'img'
).
src
=
"data:image/jpeg;base64, "
+
product
.
info
.
img
;
temp_2
.
content
.
querySelector
(
'img'
).
src
=
product
.
info
.
img
;
temp_2
.
content
.
querySelectorAll
(
'span'
)[
1
].
textContent
=
product
.
info
.
identifier
;
temp_2
.
content
.
querySelectorAll
(
'span'
)[
2
].
textContent
=
product
.
info
.
size
;
temp_2
.
content
.
querySelectorAll
(
'span'
)[
3
].
textContent
=
product
.
info
.
instrumentname
;
...
...
@@ -533,7 +533,7 @@ $(document).ready(function () {
'producttype'
:
data
.
product
.
producttype
,
'tileid'
:
data
.
product
.
tileid
,
'beginposition'
:
data
.
product
.
beginposition
,
//
'img' : data.img,
'img'
:
data
.
img
,
'identifier'
:
data
.
product
.
identifier
,
'size'
:
data
.
product
.
size
,
'instrumentname'
:
data
.
product
.
instrumentname
...
...
catalog/templates/show_cart.html
View file @
d99fa5af
...
...
@@ -166,7 +166,8 @@
{% for catalog in product.catalog %}
<li
class=
"item"
>
<div
class=
"product-img"
>
<img
src=
"data:image/jpeg;base64, {{ catalog.info.img }}"
>
<img
src=
"{% static 'catalog/images/sat_preview/' %}{{ catalog.info.identifier }}_preview.png"
>
<!--<img src="{{ catalog.info.img }}"> -->
</div>
<div
class=
"product-info"
style=
"word-break: break-all"
>
<span
class=
"product-title"
>
...
...
catalog/views.py
View file @
d99fa5af
...
...
@@ -16,6 +16,7 @@ import os
from
geosentinel
import
APISentinel
,
polygonToBox
from
mail.views
import
wsMail
,
wsMail2
from
django.contrib
import
messages
import
base64
dirname
=
os
.
path
.
dirname
(
__file__
)
configfile
=
os
.
path
.
join
(
dirname
,
'../config/config.json'
)
...
...
@@ -219,7 +220,25 @@ def saveInCart(request):
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
product_list
=
json
.
loads
(
request
.
POST
[
'cart_product_list'
])
search
=
Search
.
objects
.
filter
(
user
=
user
)
.
last
()
#print("saveIncart")
#print(search)
#print(product_list)
#reemplaza la imagen base64 que se guardaba en la bd por un archivo .png y solo se guarda la ruta
#-------
for
product
in
product_list
:
#print(product['info']['img'])
img_file
=
"catalog/static/catalog/images/sat_preview/"
+
product
[
'info'
][
'identifier'
]
+
"_preview.png"
;
if
(
not
os
.
path
.
isfile
(
img_file
)
):
#si no existe el preview lo crea
#print("crea!")
fh
=
open
(
"catalog/static/catalog/images/sat_preview/"
+
product
[
'info'
][
'identifier'
]
+
"_preview.png"
,
"wb"
)
decstr
=
base64
.
b64decode
(
product
[
'info'
][
'img'
])
fh
.
write
(
decstr
)
fh
.
close
()
product
[
'info'
][
'img'
]
=
img_file
;
#------
print
(
product_list
)
if
(
len
(
product_list
)
!=
0
):
cartProd
=
Purchase
(
user
=
user
,
...
...
@@ -228,7 +247,7 @@ def saveInCart(request):
purchased
=
False
,
price
=
5.0
)
cartProd
.
save
()
sav
=
cartProd
.
save
()
return
HttpResponse
(
status
=
204
)
...
...
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