incorporate add_ask into campaign management
parent
73c616092d
commit
40831b6161
|
@ -8,13 +8,20 @@ from django.db import models
|
|||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
# Adding field 'Campaign.use_add_ask'
|
||||
db.add_column('core_campaign', 'use_add_ask',
|
||||
self.gf('django.db.models.fields.BooleanField')(default=True),
|
||||
keep_default=False)
|
||||
|
||||
# Adding field 'EbookFile.asking'
|
||||
db.add_column('core_ebookfile', 'asking',
|
||||
self.gf('django.db.models.fields.BooleanField')(default=False),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting field 'Campaign.use_add_ask'
|
||||
db.delete_column('core_campaign', 'use_add_ask')
|
||||
|
||||
# Deleting field 'EbookFile.asking'
|
||||
db.delete_column('core_ebookfile', 'asking')
|
||||
|
||||
|
@ -75,7 +82,7 @@ class Migration(SchemaMigration):
|
|||
'license': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'}),
|
||||
'nonce': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
|
||||
'refreshed': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'refreshes': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2014, 8, 25, 0, 0)', 'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'refreshes': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2014, 8, 28, 0, 0)', 'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'acqs'", 'to': "orm['auth.User']"}),
|
||||
'watermarked': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['booxtream.Boox']", 'null': 'True'}),
|
||||
'work': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'acqs'", 'to': "orm['core.Work']"})
|
||||
|
@ -116,6 +123,7 @@ class Migration(SchemaMigration):
|
|||
'status': ('django.db.models.fields.CharField', [], {'default': "'INITIALIZED'", 'max_length': '15', 'null': 'True', 'db_index': 'True'}),
|
||||
'target': ('django.db.models.fields.DecimalField', [], {'default': '0.0', 'null': 'True', 'max_digits': '14', 'decimal_places': '2'}),
|
||||
'type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'}),
|
||||
'use_add_ask': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'work': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'campaigns'", 'to': "orm['core.Work']"})
|
||||
},
|
||||
'core.campaignaction': {
|
||||
|
@ -129,7 +137,7 @@ class Migration(SchemaMigration):
|
|||
'core.celerytask': {
|
||||
'Meta': {'object_name': 'CeleryTask'},
|
||||
'active': ('django.db.models.fields.NullBooleanField', [], {'default': 'True', 'null': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2014, 8, 25, 0, 0)', 'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2014, 8, 28, 0, 0)', 'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'description': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True'}),
|
||||
'function_args': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
|
||||
'function_name': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
|
|
@ -401,6 +401,7 @@ class Campaign(models.Model):
|
|||
email = models.CharField(max_length=100, blank=True)
|
||||
publisher = models.ForeignKey("Publisher", related_name="campaigns", null=True)
|
||||
do_watermark = models.BooleanField(default=True)
|
||||
use_add_ask = models.BooleanField(default=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.problems=[]
|
||||
|
|
|
@ -127,6 +127,10 @@ def notify_ending_soon():
|
|||
def watermark_acq(acq):
|
||||
acq.get_watermarked()
|
||||
|
||||
@task
|
||||
def add_ask_to_ebfs(campaign):
|
||||
campaign.add_ask_to_ebfs()
|
||||
|
||||
@task
|
||||
def refresh_acqs():
|
||||
in_10_min = now() + timedelta(minutes=10)
|
||||
|
|
|
@ -478,7 +478,7 @@ def getManageCampaignForm ( instance, data=None, initial=None, *args, **kwargs )
|
|||
|
||||
class Meta:
|
||||
model = Campaign
|
||||
fields = 'description', 'details', 'license', 'target', 'deadline', 'paypal_receiver', 'edition', 'email', 'publisher', 'cc_date_initial', "do_watermark"
|
||||
fields = 'description', 'details', 'license', 'target', 'deadline', 'paypal_receiver', 'edition', 'email', 'publisher', 'cc_date_initial', "do_watermark", "use_add_ask",
|
||||
widgets = { 'deadline': SelectDateWidget }
|
||||
|
||||
def clean_target(self):
|
||||
|
|
|
@ -157,7 +157,7 @@ Please fix the following before launching your campaign:
|
|||
<h3>Uploaded Files</h3>
|
||||
{% endif %}
|
||||
{% if campaign.work.epubfiles.0 %}
|
||||
<p>Active EPUB file: <a href="{{campaign.work.epubfiles.0.file.url}}">{{campaign.work.epubfiles.0.file}}</a> <br />created {{campaign.work.epubfiles.0.created}} for edition <a href="#edition_{{campaign.work.epubfiles.0.edition.id}}">{{campaign.work.epubfiles.0.edition.id}}</a> </p>
|
||||
<p>Active EPUB file: <a href="{{campaign.work.epubfiles.0.file.url}}">{{campaign.work.epubfiles.0.file}}</a> <br />created {{campaign.work.epubfiles.0.created}} for edition <a href="#edition_{{campaign.work.epubfiles.0.edition.id}}">{{campaign.work.epubfiles.0.edition.id}}</a> {% if campaign.work.epubfiles.0.asking %}(This file has had the campaign 'ask' added.){% endif %}</p>
|
||||
{% if campaign.work.test_acqs.0 %}
|
||||
<ul>
|
||||
<li><a href="{{campaign.work.test_acqs.0.watermarked.download_link_epub}}">Processed epub for testing</a></li>
|
||||
|
@ -166,10 +166,10 @@ Please fix the following before launching your campaign:
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
{% if campaign.work.mobifiles.0 %}
|
||||
<p>Active MOBI file: <a href="{{campaign.work.mobifiles.0.file.url}}">{{campaign.work.mobifiles.0.file}}</a> <br />created {{campaign.work.mobifiles.0.created}} for edition <a href="#edition_{{campaign.work.mobifiles.0.edition.id}}">{{campaign.work.mobifiles.0.edition.id}}</a> </p>
|
||||
<p>Active MOBI file: <a href="{{campaign.work.mobifiles.0.file.url}}">{{campaign.work.mobifiles.0.file}}</a> <br />created {{campaign.work.mobifiles.0.created}} for edition <a href="#edition_{{campaign.work.mobifiles.0.edition.id}}">{{campaign.work.mobifiles.0.edition.id}}</a> {% if campaign.work.mobifiles.0.asking %}(This file has had the campaign 'ask' added.){% endif %}</p>
|
||||
{% endif %}
|
||||
{% if campaign.work.pdffiles.0 %}
|
||||
<p>Active PDF file: <a href="{{campaign.work.pdffiles.0.file.url}}">{{campaign.work.pdffiles.0.file}}</a> <br />created {{campaign.work.pdffiles.0.created}} for edition <a href="#edition_{{campaign.work.pdffiles.0.edition.id}}">{{campaign.work.pdffiles.0.edition.id}}</a> </p>
|
||||
<p>Active PDF file: <a href="{{campaign.work.pdffiles.0.file.url}}">{{campaign.work.pdffiles.0.file}}</a> <br />created {{campaign.work.pdffiles.0.created}} for edition <a href="#edition_{{campaign.work.pdffiles.0.edition.id}}">{{campaign.work.pdffiles.0.edition.id}}</a> {% if campaign.work.pdffiles.0.asking %}(This file has had the campaign 'ask' added.){% endif %}</p>
|
||||
{% endif %}
|
||||
{% ifnotequal campaign_status 'ACTIVE' %}
|
||||
{% ifnotequal campaign.type 3 %}
|
||||
|
@ -318,6 +318,12 @@ Please fix the following before launching your campaign:
|
|||
<div style="padding-top:2em;padding-bottom:0.5em">Next, the <b>Ask</b>. A "thank you" form will float right in this area, so don't use wide graphic elements.</div>
|
||||
{% endifequal %}
|
||||
{{ form.description.errors }}{{ form.description }}
|
||||
{% ifequal campaign.type 3 %}
|
||||
<h3>Enable "Thanks" in your ebook files</h3>
|
||||
<p> Unglue.it can add your "Ask" along with a link to your book's "thank the creators" page into your ebook files. That way, people who download the book without making a contribution will be reminded that they can do it later.</p>
|
||||
<div class="std_form">Add your ask to files: {{ form.use_add_ask.errors }}{{ form.use_add_ask }}</div>
|
||||
|
||||
{% endifequal %}
|
||||
<h3>Edition and Rights Details</h3>
|
||||
<p>This will be displayed on the More... tab for your work. It's the fine print for your campaign. {% ifequal campaign.type 1 %}Make sure to disclose any ways the unglued edition will differ from the existing edition; for example:
|
||||
<ul class="bullets">
|
||||
|
|
|
@ -685,6 +685,7 @@ def manage_campaign(request, id, action='manage'):
|
|||
campaign.update_left()
|
||||
if campaign.type is THANKS :
|
||||
campaign.work.description = form.cleaned_data['work_description']
|
||||
tasks.add_ask_to_ebfs.delay(campaign)
|
||||
campaign.work.save()
|
||||
alerts.append(_('Campaign data has been saved'))
|
||||
activetab = '#2'
|
||||
|
|
Loading…
Reference in New Issue