Commit 1883e2cb3157904bbd1deea6cac70beb0de556f0

Authored by fbormann
1 parent b240c455

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
@@ -117,7 +117,7 @@ a, a:focus, a:hover { @@ -117,7 +117,7 @@ a, a:focus, a:hover {
117 117
118 /* === Resources Common (ex: PDF, WebPage) App === */ 118 /* === Resources Common (ex: PDF, WebPage) App === */
119 .topic-panel > .panel-heading { 119 .topic-panel > .panel-heading {
120 - background-color: #1d8fe0 !important; } 120 + background-color: #0277BD !important; }
121 121
122 .topic-panel .category-header .category-card-items i, .topic-panel-invisible .category-header .category-card-items i { 122 .topic-panel .category-header .category-card-items i, .topic-panel-invisible .category-header .category-card-items i {
123 color: #1772b3; } 123 color: #1772b3; }
amadeus/static/css/themes/green.sass
@@ -170,7 +170,7 @@ a, a:focus, a:hover @@ -170,7 +170,7 @@ a, a:focus, a:hover
170 /* === Resources Common (ex: PDF, WebPage) App === */ 170 /* === Resources Common (ex: PDF, WebPage) App === */
171 171
172 .topic-panel > .panel-heading 172 .topic-panel > .panel-heading
173 - background-color: #1d8fe0 !important 173 + background-color: #0277BD !important
174 174
175 175
176 .topic-panel .category-header .category-card-items i, .topic-panel-invisible .category-header .category-card-items i 176 .topic-panel .category-header .category-card-items i, .topic-panel-invisible .category-header .category-card-items i
reports/views.py
@@ -22,6 +22,7 @@ from .models import ReportCSV, ReportXLS @@ -22,6 +22,7 @@ from .models import ReportCSV, ReportXLS
22 import pandas as pd 22 import pandas as pd
23 import math 23 import math
24 from io import BytesIO 24 from io import BytesIO
  25 +import os
25 26
26 class ReportView(LoginRequiredMixin, generic.FormView): 27 class ReportView(LoginRequiredMixin, generic.FormView):
27 template_name = "reports/create.html" 28 template_name = "reports/create.html"
@@ -165,6 +166,10 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): @@ -165,6 +166,10 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView):
165 report = ReportXLS.objects.get(user=self.request.user) 166 report = ReportXLS.objects.get(user=self.request.user)
166 report.delete() 167 report.delete()
167 168
  169 + folder_path = join(settings.MEDIA_ROOT, 'files')
  170 + #check if the folder already exists
  171 + if not os.path.isdir(folder_path):
  172 + os.makedirs(folder_path)
168 path = join(settings.MEDIA_ROOT, 'files' , 'report'+str(self.request.user.id)+'.xls') 173 path = join(settings.MEDIA_ROOT, 'files' , 'report'+str(self.request.user.id)+'.xls')
169 writer = pd.ExcelWriter(path) 174 writer = pd.ExcelWriter(path)
170 df.to_excel(writer, sheet_name='first_sheet') 175 df.to_excel(writer, sheet_name='first_sheet')