add ebook activation on edition edit
parent
8de43cfda8
commit
711f2880fa
|
@ -0,0 +1,18 @@
|
|||
{% if work.ebooks_all %}
|
||||
<h3>Manage eBooks</h3>
|
||||
<ul>
|
||||
{% for ebook in work.ebooks_all %}
|
||||
<li>
|
||||
<a href="{{ ebook.url }}">{{ ebook.format }}</a>, created {{ ebook.created }}{% if ebook.user %},
|
||||
by <a href="{% url 'supporter' ebook.user.id %}">{{ ebook.user }}</a>{% endif %}.
|
||||
{% if ebook.filesize %}{{ ebook.filesize }}{% else %}??{% endif %}B
|
||||
{% if ebook.version_label %}{{ ebook.version }}{% endif %}
|
||||
{% if ebook.active %}<input type="submit" name="deactivate_ebook_{{ ebook.id }}" value="deactivate" class="deletebutton" title="deactivate ebook" />{% else %}<input type="submit" name="activate_ebook_{{ ebook.id }}" value="activate" class="deletebutton" title="activate ebook" />{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<br />
|
||||
<br />
|
||||
<input type="submit" name="activate_all_ebooks" value="activate all ebooks" class="deletebutton" title="activate all ebooks" />
|
||||
<input type="submit" name="deactivate_all_ebooks" value="deactivate all ebooks" class="deletebutton" title="deactivate all ebooks" />
|
||||
{% endif %}
|
|
@ -217,7 +217,11 @@ ul.fancytree-container {
|
|||
</p>
|
||||
</div>
|
||||
<input type="submit" name="create_new_edition" style="font-size: larger;" value="{% if edition.pk %}Save Edits{% else %}Create Edition{% endif %}" id="submit">
|
||||
{% with edition.work as work %}
|
||||
{% include 'ebook_list.html' %}
|
||||
{% endwith %}
|
||||
</form>
|
||||
|
||||
{% if edition.work %}
|
||||
|
||||
<h2>More Edition Management</h2>
|
||||
|
|
|
@ -226,7 +226,18 @@ def edit_edition(request, work_id, edition_id, by=None):
|
|||
work_rel.delete()
|
||||
form = EditionForm(instance=edition, data=request.POST, files=request.FILES)
|
||||
break
|
||||
|
||||
activate_all = request.POST.has_key('activate_all_ebooks')
|
||||
deactivate_all = request.POST.has_key('deactivate_all_ebooks')
|
||||
ebookchange = False
|
||||
for ebook in work.ebooks_all():
|
||||
if request.POST.has_key('activate_ebook_%s' % ebook.id) or activate_all:
|
||||
ebook.activate()
|
||||
ebookchange = True
|
||||
elif request.POST.has_key('deactivate_ebook_%s' % ebook.id) or deactivate_all:
|
||||
ebook.deactivate()
|
||||
ebookchange = True
|
||||
if ebookchange:
|
||||
form = EditionForm(instance=edition, data=request.POST, files=request.FILES)
|
||||
if request.POST.has_key('add_author_submit') and admin:
|
||||
new_author_name = request.POST['add_author'].strip()
|
||||
new_author_relation = request.POST['add_author_relation']
|
||||
|
|
Loading…
Reference in New Issue