uploader now generates mobi for unglued b2u files
parent
ba3c85d8ac
commit
fe931c7835
|
@ -918,6 +918,13 @@ class Campaign(models.Model):
|
|||
provider="Unglue.it",
|
||||
url= settings.BASE_URL_SECURE + reverse('download_campaign',args=[self.work.id,format]),
|
||||
)
|
||||
old_ebooks = Ebook.objects.exclude(pk=ebook.pk).filter(
|
||||
format=format,
|
||||
rights=self.license,
|
||||
provider="Unglue.it",
|
||||
)
|
||||
for old_ebook in old_ebooks:
|
||||
old_ebook.delete()
|
||||
return ebook.pk
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
{% block doccontent %}
|
||||
<div class="work_campaigns">
|
||||
<b>Title</b>: {{ edition.title}}<br />
|
||||
<b>Title</b>: <a href="{% url work edition.work.id %}">{{ edition.title}}</a><br />
|
||||
<b>Publisher</b> : {{ edition.publisher_name }}<br />
|
||||
<b>Authors</b>:
|
||||
<ul>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<h2> Ebook Files for this Edition</h2>
|
||||
<ul>
|
||||
{% for ebook_file in edition.ebook_files.all %}
|
||||
<li>{{ebook_file.file}} created {{ebook_file.created}} </li>
|
||||
<li><a href="{{ebook_file.file.url}}">{{ebook_file.file}}</a> created {{ebook_file.created}} </li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
@ -36,13 +36,13 @@
|
|||
<li><a href="{{watermarked.download_link_epub}}">Watermarked epub for testing</a></li>
|
||||
<li><a href="{{watermarked.download_link_mobi}}">Watermarked mobi for testing</a></li>
|
||||
</ul>
|
||||
{% else %}
|
||||
{% else %}{% if upload_error %}
|
||||
<p>
|
||||
<span class="yikes">Unfortunately, your file failed testing.</span>
|
||||
The error(s) were: <pre>
|
||||
{{ upload_error }}</pre>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}{% endif %}
|
||||
{% endifequal %}
|
||||
{% ifequal edition.work.last_campaign.type 3 %}
|
||||
{% if upload_error %}
|
||||
|
@ -55,7 +55,7 @@
|
|||
{{ upload_error }}
|
||||
<h2>Upload Ebook files</h2>
|
||||
{% ifequal edition.work.last_campaign.type 2 %}
|
||||
<p>At this time, we accept only EPUB files for "Buy to Unglue" campaigns.
|
||||
<p>At this time, we accept only EPUB files for "Buy to Unglue" campaigns. Files for Kindle will be autogenerated.
|
||||
{% endifequal %}
|
||||
{% ifequal edition.work.last_campaign.type 3 %}
|
||||
<p>You can upload PDF, EPUB and MOBI files for "Thanks for Ungluing" campaigns.
|
||||
|
|
|
@ -436,14 +436,21 @@ def edition_uploads(request, edition_id):
|
|||
form.save()
|
||||
context['uploaded']=True
|
||||
if campaign_type == BUY2UNGLUE:
|
||||
# campaign mangager gets a copy
|
||||
test_acq = models.Acq.objects.create(user=request.user,work=edition.work,license= TESTING)
|
||||
try:
|
||||
test_acq.get_watermarked()
|
||||
context['watermarked']= test_acq.watermarked
|
||||
except Exception as e:
|
||||
context['upload_error']= e
|
||||
form.instance.delete()
|
||||
if edition.work.last_campaign().status == 'SUCCESSFUL':
|
||||
try:
|
||||
edition.work.last_campaign().watermark_success()
|
||||
except Exception as e:
|
||||
context['upload_error']= e
|
||||
form.instance.delete()
|
||||
else:
|
||||
# campaign mangager gets a copy
|
||||
test_acq = models.Acq.objects.create(user=request.user,work=edition.work,license= TESTING)
|
||||
try:
|
||||
test_acq.get_watermarked()
|
||||
context['watermarked']= test_acq.watermarked
|
||||
except Exception as e:
|
||||
context['upload_error']= e
|
||||
form.instance.delete()
|
||||
if campaign_type == THANKS:
|
||||
e = form.instance.check_file()
|
||||
if e != None:
|
||||
|
|
Loading…
Reference in New Issue