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
28f19ead
Commit
28f19ead
authored
Feb 08, 2019
by
Irving David
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Añadido que los reportes tomen el path de usuarios del archivo de configuración
parent
616afd70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
30 deletions
+14
-30
views.py
catalog/views.py
+1
-26
views.py
reports/views.py
+13
-4
No files found.
catalog/views.py
View file @
28f19ead
...
...
@@ -558,31 +558,6 @@ def Pay (request):
#-------------------------------------
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
prod_list
=
[]
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'user'
,
'productList'
,
'purchased'
,
'price'
,
'aggreg_date'
,
'search__process_id__name'
)
.
filter
(
user
=
user
,
purchased
=
0
)
total_price
=
0
total_products
=
0
for
products
in
product_list
:
product
=
json
.
loads
(
products
[
'productList'
])
prod_list
.
append
({
'purchased'
:
products
[
'purchased'
],
'price'
:
products
[
'price'
],
'aggreg_date'
:
products
[
'aggreg_date'
],
'catalog'
:
product
,
'product_id'
:
products
[
'id'
],
"process"
:
products
[
'search__process_id__name'
],
})
total_price
+=
products
[
'price'
]
total_products
+=
1
return
render
(
request
,
'show_cart.html'
,
{
'product_list'
:
prod_list
,
'total_price'
:
total_price
,
'total_products'
:
total_products
})
#-------------------------------------
def
Pay
(
request
):
Purchase
.
objects
.
filter
(
user_id
=
request
.
user
.
id
,
purchased
=
0
)
.
update
(
purchased
=
True
)
return
redirect
(
'../../reports'
)
reports/views.py
View file @
28f19ead
...
...
@@ -9,6 +9,7 @@ from django.shortcuts import render
# Create your views here.
from
collections
import
OrderedDict
import
json
import
os
# -------------------------------------------------------------------------------
from
reportlab.pdfgen
import
canvas
...
...
@@ -16,12 +17,20 @@ from reportlab.pdfgen import canvas
from
GeoInt_SIDT
import
settings
from
catalog.models
import
CartProduct
,
Purchase
,
Search
########### lee archivo de configuración ################
dirname
=
os
.
path
.
dirname
(
__file__
)
configfile
=
os
.
path
.
join
(
dirname
,
'../config/config.json'
)
with
open
(
configfile
,
'r'
)
as
f
:
config
=
json
.
load
(
f
)
USERS_PATH
=
config
[
'PATHS'
][
'PATH_USERS'
]
###########################################################
def
report_L2ASCL
(
request
,
report
,
purchase_id
):
################################################################################
# PONER EL NOMBRE DE SU MAQUINA #
################################################################################
with
open
(
"/home/ulises/NAS/repsat_test_dev/"
+
request
.
user
.
email
+
"/"
+
purchase_id
+
"/"
+
report
+
".json"
)
as
f
:
with
open
(
USERS_PATH
+
request
.
user
.
email
+
"/"
+
purchase_id
+
"/"
+
report
+
".json"
)
as
f
:
json_data
=
OrderedDict
(
json
.
load
(
f
))
graphData
=
dict
()
graphData
[
'type'
]
=
"line"
...
...
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