Commit 28f19ead authored by Irving David's avatar Irving David

Añadido que los reportes tomen el path de usuarios del archivo de configuración

parent 616afd70
......@@ -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')
......@@ -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"
......
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