From: Charles Connell Date: Tue, 11 Mar 2014 00:48:13 +0000 (-0400) Subject: Disable download button if we don't have a fp_file field X-Git-Tag: release-20150131~148^2~8 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5e913f7d534d7985102a2018758e07555c7dee6b;p=oweals%2Fkarmaworld.git Disable download button if we don't have a fp_file field --- diff --git a/karmaworld/apps/notes/models.py b/karmaworld/apps/notes/models.py index 3e58f48..45c4caa 100644 --- a/karmaworld/apps/notes/models.py +++ b/karmaworld/apps/notes/models.py @@ -158,6 +158,9 @@ class Document(models.Model): Returns the Filepicker URL for reading the upstream document. """ # Fetch FilepickerFile + if not self.fp_file.name: + return None + fpf = self._get_fpf() # Return proper URL for reading return fpf.get_url() diff --git a/karmaworld/templates/notes/note_detail.html b/karmaworld/templates/notes/note_detail.html index 0f6ac93..52286c3 100644 --- a/karmaworld/templates/notes/note_detail.html +++ b/karmaworld/templates/notes/note_detail.html @@ -116,15 +116,25 @@
- + {% if note.get_fp_url %} + + note_download + + {% else %} note_download - + {% endif %}
{% else %}