From 1883e2cb3157904bbd1deea6cac70beb0de556f0 Mon Sep 17 00:00:00 2001 From: fbormann Date: Thu, 30 Mar 2017 15:09:06 -0300 Subject: [PATCH] solved error in CSS as well as if the folder doesn't exists to save .xls files of reports --- amadeus/static/css/themes/green.css | 2 +- amadeus/static/css/themes/green.sass | 2 +- reports/views.py | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/amadeus/static/css/themes/green.css b/amadeus/static/css/themes/green.css index 8b8ca22..8e490e3 100644 --- a/amadeus/static/css/themes/green.css +++ b/amadeus/static/css/themes/green.css @@ -117,7 +117,7 @@ a, a:focus, a:hover { /* === Resources Common (ex: PDF, WebPage) App === */ .topic-panel > .panel-heading { - background-color: #1d8fe0 !important; } + background-color: #0277BD !important; } .topic-panel .category-header .category-card-items i, .topic-panel-invisible .category-header .category-card-items i { color: #1772b3; } diff --git a/amadeus/static/css/themes/green.sass b/amadeus/static/css/themes/green.sass index 75dbab7..a856c8a 100644 --- a/amadeus/static/css/themes/green.sass +++ b/amadeus/static/css/themes/green.sass @@ -170,7 +170,7 @@ a, a:focus, a:hover /* === Resources Common (ex: PDF, WebPage) App === */ .topic-panel > .panel-heading - background-color: #1d8fe0 !important + background-color: #0277BD !important .topic-panel .category-header .category-card-items i, .topic-panel-invisible .category-header .category-card-items i diff --git a/reports/views.py b/reports/views.py index a0d4397..cf38042 100644 --- a/reports/views.py +++ b/reports/views.py @@ -22,6 +22,7 @@ from .models import ReportCSV, ReportXLS import pandas as pd import math from io import BytesIO +import os class ReportView(LoginRequiredMixin, generic.FormView): template_name = "reports/create.html" @@ -165,6 +166,10 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): report = ReportXLS.objects.get(user=self.request.user) report.delete() + folder_path = join(settings.MEDIA_ROOT, 'files') + #check if the folder already exists + if not os.path.isdir(folder_path): + os.makedirs(folder_path) path = join(settings.MEDIA_ROOT, 'files' , 'report'+str(self.request.user.id)+'.xls') writer = pd.ExcelWriter(path) df.to_excel(writer, sheet_name='first_sheet') -- libgit2 0.21.2