From e42ad0c9a2f9981a7481b2b9d39f82b2222e6ad8 Mon Sep 17 00:00:00 2001 From: Seth Woodworth Date: Mon, 1 Jul 2013 12:50:00 -0400 Subject: [PATCH] making assorted changes for ppt file_type marking on the Note model --- karmaworld/apps/notes/models.py | 1 + karmaworld/apps/notes/views.py | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/karmaworld/apps/notes/models.py b/karmaworld/apps/notes/models.py index 0552cc9..768fce7 100644 --- a/karmaworld/apps/notes/models.py +++ b/karmaworld/apps/notes/models.py @@ -33,6 +33,7 @@ class Note(models.Model): ('doc', 'MS Word compatible file (.doc, .docx, .rtf, .odf)'), ('img', 'Scan or picture of notes'), ('pdf', 'PDF file'), + ('ppt', 'Powerpoint'), (UNKNOWN_FILE, 'Unknown file'), ) diff --git a/karmaworld/apps/notes/views.py b/karmaworld/apps/notes/views.py index 2202a86..e9bffc1 100644 --- a/karmaworld/apps/notes/views.py +++ b/karmaworld/apps/notes/views.py @@ -27,8 +27,7 @@ def is_pdf(self): return False def is_ppt(self): - if self.object.pdf_file: - print "is a ppt" + if self.object.file_type == 'ppt': return True return False @@ -42,7 +41,7 @@ class NoteDetailView(DetailView): """ Generate custom context for the page rendering a Note + if pdf, set the `pdf` flag """ - #kwargs['file_url'] = os.path.basename(_path) + # not current using these #kwargs['hostname'] = Site.objects.get_current() kwargs['pdf'] = is_pdf(self) @@ -125,8 +124,6 @@ class PDFView(DetailView): def get_context_data(self, **kwargs): """ Generate a path to the pdf file associated with this note by generating a path to the MEDIA_URL by hand """ - # FIXME: There may be an undocumented, - # but better way of handling media files in django if is_ppt: kwargs['pdf_path'] = "{0}{1}".format(settings.MEDIA_URL, -- 2.25.1