add work.formats()
parent
f662920c2a
commit
66c0d84029
|
@ -1360,6 +1360,14 @@ class Work(models.Model):
|
|||
def pdffiles(self):
|
||||
return EbookFile.objects.filter(edition__work=self, format='pdf').exclude(file='').order_by('-created')
|
||||
|
||||
def formats(self):
|
||||
fmts=[]
|
||||
for fmt in ['pdf', 'epub', 'mobi', 'html']:
|
||||
for ebook in self.ebooks().filter(format=fmt):
|
||||
fmts.append(fmt)
|
||||
break
|
||||
return fmts
|
||||
|
||||
def make_ebooks_from_ebfs(self, add_ask=True):
|
||||
# either the ebf has been uploaded or a created (perhaps an ask was added or mobi generated)
|
||||
if self.last_campaign().type != THANKS: # just to make sure that ebf's can be unglued by mistake
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% load lib_acqs %}
|
||||
{% block title %}—
|
||||
{% if work.is_free %}
|
||||
{{ work.title }} is a Free eBook. {% if work.first_pdf %}[PDF]{% endif %}{% if work.first_epub %}[EPUB, MOBI]{% endif %}
|
||||
{{ work.title }} is a Free eBook. {% for fmt in work.formats %}[{{ fmt }}]{% endfor %}
|
||||
{% else %}
|
||||
Help us make {{ work.title }} a Free eBook!
|
||||
{% endif %}{% ifequal action 'editions' %} – All Editions{% endifequal %}
|
||||
|
|
Loading…
Reference in New Issue