From b8409a815bd8feffcddf0b513b7b0cef6bec9936 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 12 Mar 2014 19:32:56 -0400 Subject: [PATCH] forgot to set status in new_edition --- frontend/templates/edition_upload.html | 4 ++-- frontend/views.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/templates/edition_upload.html b/frontend/templates/edition_upload.html index 9f271ad5..25363699 100644 --- a/frontend/templates/edition_upload.html +++ b/frontend/templates/edition_upload.html @@ -1,6 +1,6 @@
{% if edition.ebook_form %} - {% ifnotequal status 'ACTIVE' %} + {% if show_ebook_form %}
{% if edition.ebooks.all.0 %} @@ -25,7 +25,7 @@
{% else %}
Uploads are disabled for this work.
- {% endifnotequal %} + {% endif %} {% endif %}
\ No newline at end of file diff --git a/frontend/views.py b/frontend/views.py index 2163a4ba..986eb1bd 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -616,9 +616,13 @@ def new_edition(request, work_id, edition_id, by=None): if edition.pk: edition.ebook_form = EbookForm( instance= models.Ebook(user = request.user, edition = edition, provider = 'x' ), prefix = 'ebook_%d'%edition.id) form = EditionForm(instance=edition, initial=initial) - + try: + show_ebook_form = edition.work.last_campaign().status not in ['ACTIVE','INITIALIZED'] + except: + show_ebook_form = True return render(request, 'new_edition.html', { - 'form': form, 'edition': edition, 'admin':admin, 'alert':alert + 'form': form, 'edition': edition, 'admin':admin, 'alert':alert, + 'show_ebook_form':show_ebook_form, }) def campaign_results(request, campaign):