Refactor Note > Document, an Abstract Base Class
[oweals/karmaworld.git] / karmaworld / apps / notes / views.py
index e9bffc1578db60b8794c1b0d011032f6be4bb118..f0f9a2983035bed6e3f47d56578d4a9df9731ca2 100644 (file)
@@ -86,6 +86,8 @@ class NoteSaveView(FormView, SingleObjectMixin):
         self.object.year = form.cleaned_data['year']
         # use *arg expansion to pass tags a list of tags
         self.object.tags.add(*form.cleaned_data['tags'])
+        # User has submitted this form, so set the SHOW flag
+        self.object.draft = False
         self.object.save()
         return super(NoteSaveView, self).form_valid(form)
 
@@ -125,10 +127,10 @@ class PDFView(DetailView):
         """ Generate a path to the pdf file associated with this note
             by generating a path to the MEDIA_URL by hand """
 
-        if is_ppt:
+        if is_ppt(self):
             kwargs['pdf_path'] = "{0}{1}".format(settings.MEDIA_URL,
                 os.path.basename(self.object.pdf_file.name))
-        elif is_pdf:
+        elif is_pdf(self):
             kwargs['pdf_path'] = "{0}{1}".format(settings.MEDIA_URL,
                 os.path.basename(self.object.note_file.name))