From 82914e9a225a0fbcbb19af0940fd58cd1d783253 Mon Sep 17 00:00:00 2001 From: Josh Williams Date: Thu, 26 Sep 2013 15:27:29 -0400 Subject: [PATCH] Detect and display PDF and PPT note files --- karmaworld/apps/notes/views.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/karmaworld/apps/notes/views.py b/karmaworld/apps/notes/views.py index f19cdff..f1384ce 100644 --- a/karmaworld/apps/notes/views.py +++ b/karmaworld/apps/notes/views.py @@ -20,9 +20,7 @@ from karmaworld.apps.notes.forms import NoteForm def is_pdf(self): - _path = self.object.note_file.name - _, _extension = os.path.splitext(_path) - if _extension.lower() == '.pdf': + if self.object.file_type == 'pdf': return True return False @@ -131,7 +129,8 @@ class PDFView(DetailView): kwargs['pdf_path'] = "{0}{1}".format(settings.MEDIA_URL, os.path.basename(self.object.pdf_file.name)) elif is_pdf(self): - kwargs['pdf_path'] = "{0}{1}".format(settings.MEDIA_URL, - os.path.basename(self.object.note_file.name)) + kwargs['pdf_path'] = self.object.fp_file + #kwargs['pdf_path'] = "{0}{1}".format(settings.MEDIA_URL, + # os.path.basename(self.object.note_file.name)) return super(PDFView, self).get_context_data(**kwargs) -- 2.25.1