From 5e913f7d534d7985102a2018758e07555c7dee6b Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Mon, 10 Mar 2014 20:48:13 -0400 Subject: [PATCH] Disable download button if we don't have a fp_file field --- karmaworld/apps/notes/models.py | 3 +++ karmaworld/templates/notes/note_detail.html | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) 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 %}
-- 2.25.1