Commit 1883e2cb3157904bbd1deea6cac70beb0de556f0
1 parent
b240c455
Exists in
master
and in
2 other branches
solved error in CSS as well as if the folder doesn't exists to save .xls files of reports
Showing
3 changed files
with
7 additions
and
2 deletions
Show diff stats
amadeus/static/css/themes/green.css
... | ... | @@ -117,7 +117,7 @@ a, a:focus, a:hover { |
117 | 117 | |
118 | 118 | /* === Resources Common (ex: PDF, WebPage) App === */ |
119 | 119 | .topic-panel > .panel-heading { |
120 | - background-color: #1d8fe0 !important; } | |
120 | + background-color: #0277BD !important; } | |
121 | 121 | |
122 | 122 | .topic-panel .category-header .category-card-items i, .topic-panel-invisible .category-header .category-card-items i { |
123 | 123 | color: #1772b3; } | ... | ... |
amadeus/static/css/themes/green.sass
... | ... | @@ -170,7 +170,7 @@ a, a:focus, a:hover |
170 | 170 | /* === Resources Common (ex: PDF, WebPage) App === */ |
171 | 171 | |
172 | 172 | .topic-panel > .panel-heading |
173 | - background-color: #1d8fe0 !important | |
173 | + background-color: #0277BD !important | |
174 | 174 | |
175 | 175 | |
176 | 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 | 22 | import pandas as pd |
23 | 23 | import math |
24 | 24 | from io import BytesIO |
25 | +import os | |
25 | 26 | |
26 | 27 | class ReportView(LoginRequiredMixin, generic.FormView): |
27 | 28 | template_name = "reports/create.html" |
... | ... | @@ -165,6 +166,10 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): |
165 | 166 | report = ReportXLS.objects.get(user=self.request.user) |
166 | 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 | 173 | path = join(settings.MEDIA_ROOT, 'files' , 'report'+str(self.request.user.id)+'.xls') |
169 | 174 | writer = pd.ExcelWriter(path) |
170 | 175 | df.to_excel(writer, sheet_name='first_sheet') | ... | ... |