Merge branch 'master' into charge_failed
commit
6ab521faa1
|
@ -263,3 +263,30 @@ def handle_wishlist_added(supporter, work, **kwargs):
|
||||||
emit_notifications.delay()
|
emit_notifications.delay()
|
||||||
|
|
||||||
wishlist_added.connect(handle_wishlist_added)
|
wishlist_added.connect(handle_wishlist_added)
|
||||||
|
|
||||||
|
deadline_impending = Signal(providing_args=["campaign"])
|
||||||
|
|
||||||
|
def handle_wishlist_near_deadline(campaign, **kwargs):
|
||||||
|
"""
|
||||||
|
send two groups - one the nonpledgers, one the pledgers
|
||||||
|
set the pledged flag differently in the context
|
||||||
|
"""
|
||||||
|
pledgers = campaign.ungluers()['all']
|
||||||
|
nonpledgers = campaign.work.wished_by().exclude(id__in=[p.id for p in pledgers])
|
||||||
|
|
||||||
|
notification.queue(pledgers, "wishlist_near_deadline", {
|
||||||
|
'campaign': campaign,
|
||||||
|
'domain': settings.BASE_URL,
|
||||||
|
'pledged': True,
|
||||||
|
}, True)
|
||||||
|
|
||||||
|
notification.queue(nonpledgers, "wishlist_near_deadline", {
|
||||||
|
'campaign': campaign,
|
||||||
|
'domain': settings.BASE_URL,
|
||||||
|
'pledged': False,
|
||||||
|
}, True)
|
||||||
|
|
||||||
|
from regluit.core.tasks import emit_notifications
|
||||||
|
emit_notifications.delay()
|
||||||
|
|
||||||
|
deadline_impending.connect(handle_wishlist_near_deadline)
|
||||||
|
|
|
@ -12,6 +12,7 @@ from django.conf import settings
|
||||||
from regluit.core import bookloader, models
|
from regluit.core import bookloader, models
|
||||||
from regluit.core import goodreads, librarything
|
from regluit.core import goodreads, librarything
|
||||||
from regluit.core.models import Campaign
|
from regluit.core.models import Campaign
|
||||||
|
from regluit.core.signals import deadline_impending
|
||||||
from regluit.utils.localdatetime import now, date_today
|
from regluit.utils.localdatetime import now, date_today
|
||||||
|
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
|
@ -98,4 +99,15 @@ def report_new_ebooks(created=None): #created= creation date
|
||||||
for work in works:
|
for work in works:
|
||||||
notification.send_now(work.wished_by(), "wishlist_unglued_book_released", {'work':work}, True)
|
notification.send_now(work.wished_by(), "wishlist_unglued_book_released", {'work':work}, True)
|
||||||
|
|
||||||
|
@task
|
||||||
|
def notify_ending_soon():
|
||||||
|
c_active = Campaign.objects.filter(status='Active')
|
||||||
|
for c in c_active:
|
||||||
|
if c.deadline - now() < timedelta(7) and c.deadline - now() >= timedelta(6):
|
||||||
|
"""
|
||||||
|
if the campaign is still active and there's only a week left until it closes, send reminder notification
|
||||||
|
"""
|
||||||
|
deadline_impending.send(sender=None, campaign=c)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{% load humanize %}{% if campaign.left > 0 %} The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is almost out of time. We need to raise ${{ campaign.left|intcomma }} more by {{ campaign.deadline }} in order to give this book to the world.
|
{% load humanize %}{% if campaign.left > 0 %} The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is almost out of time. We need to raise ${{ campaign.left|intcomma }} more by {{ campaign.deadline }} in order to give this book to the world.
|
||||||
|
|
||||||
{% if pledged %}
|
{% if pledged %}
|
||||||
Your pledge of {{ amount|intcomma }} is helping {{ campaign.work.title }} to reach its goal, but we can only unglue this book if the campaign succeeds. You can help your pledge go farther by sharing the campaign (https://{{ site.domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation.
|
Your pledge is helping {{ campaign.work.title }} to reach its goal, but we can only unglue this book if the campaign succeeds. You can help your pledge go farther by sharing the campaign ({{ domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation.
|
||||||
{% else %}
|
{% else %}
|
||||||
We need your pledge to reach this target. Any amount helps. You can chip in towards giving this book to the world at https://{{ site.domain }}{% url pledge work_id=campaign.work.id %} .
|
If you've been meaning to get around to pledging, now's your chance. Any amount helps. You can chip in towards giving this book to the world at {{ domain }}{% url pledge work_id=campaign.work.id %} .
|
||||||
|
|
||||||
You can also help by sharing the campaign (https://{{ site.domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation.
|
You can also help by sharing the campaign ({{ domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
Thank you!
|
Thank you!
|
||||||
|
@ -14,9 +14,9 @@
|
||||||
The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is on track to succeed! It has met its target price of {{ campaign.target|intcomma }} and will close soon.
|
The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is on track to succeed! It has met its target price of {{ campaign.target|intcomma }} and will close soon.
|
||||||
|
|
||||||
{% if pledged %}
|
{% if pledged %}
|
||||||
Your pledge of ${{ amount|intcomma }} is helping us give this book to the world. Thank you! When the campaign closes, we'll be in touch about how and when you'll receive your premiums.
|
Your pledge is helping us give this book to the world. Thank you! When the campaign closes, we'll be in touch about how and when you'll receive your premiums.
|
||||||
{% else %}
|
{% else %}
|
||||||
If you wanted to support this campaign, this is your last chance. Pledge by midnight (Eastern US time) if you want to help the campaign or receive any premiums: https://{{ site.domain }}{% url pledge work_id=campaign.work.id %}
|
If you wanted to support this campaign, this is your last chance. Pledge by midnight (Eastern US time) if you want to help the campaign or receive any premiums: {{ domain }}{% url pledge work_id=campaign.work.id %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
Thanks to ungluers like you, we'll soon be able to give this book to the world together. Hooray!
|
Thanks to ungluers like you, we'll soon be able to give this book to the world together. Hooray!
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block comments_graphical %}
|
{% block comments_graphical %}
|
||||||
The campaign for {{ campaign.work.title }} is almost over.
|
The campaign to unglue {{ campaign.work.title }} is almost over.
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block comments_textual %}
|
{% block comments_textual %}
|
||||||
|
@ -13,8 +13,9 @@
|
||||||
|
|
||||||
{% if pledged %}
|
{% if pledged %}
|
||||||
Your pledge is helping us reach that goal. Will you help again by sharing this campaign with your friends?
|
Your pledge is helping us reach that goal. Will you help again by sharing this campaign with your friends?
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
You can help us give this book to the world by <a href="{% url pledge work_id=campaign.work.id %}">pledging</a> or by sharing this campaign with your friends.
|
If you've been meaning to pledge, <a href="{% url pledge work_id=campaign.work.id %}">now's your chance</a>. You can also help by sharing this campaign with your friends.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% url work campaign.work.id as work_url %}
|
{% url work campaign.work.id as work_url %}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{campaign.work.title}} is running out of time
|
Almost out of time to unglue {{campaign.work.title}}
|
|
@ -278,6 +278,12 @@ EBOOK_NOTIFICATIONS_JOB = {
|
||||||
"args": ()
|
"args": ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NOTIFY_ENDING_SOON_JOB = {
|
||||||
|
"task": "regluit.core.tasks.notify_ending_soon",
|
||||||
|
"schedule": crontab(hour=1, minute=0),
|
||||||
|
"args": ()
|
||||||
|
}
|
||||||
|
|
||||||
# by default, in common, we don't turn any of the celerybeat jobs on -- turn them on in the local settings file
|
# by default, in common, we don't turn any of the celerybeat jobs on -- turn them on in the local settings file
|
||||||
|
|
||||||
# amazon or paypal for now.
|
# amazon or paypal for now.
|
||||||
|
|
|
@ -138,6 +138,7 @@ CKEDITOR_UPLOAD_PATH = '/var/www/static/media/'
|
||||||
# update the statuses of campaigns
|
# update the statuses of campaigns
|
||||||
CELERYBEAT_SCHEDULE['update_active_campaign_statuses'] = UPDATE_ACTIVE_CAMPAIGN_STATUSES
|
CELERYBEAT_SCHEDULE['update_active_campaign_statuses'] = UPDATE_ACTIVE_CAMPAIGN_STATUSES
|
||||||
CELERYBEAT_SCHEDULE['report_new_ebooks'] = EBOOK_NOTIFICATIONS_JOB
|
CELERYBEAT_SCHEDULE['report_new_ebooks'] = EBOOK_NOTIFICATIONS_JOB
|
||||||
|
CELERYBEAT_SCHEDULE['notify_ending_soon'] = NOTIFY_ENDING_SOON_JOB
|
||||||
|
|
||||||
# set -- sandbox or production Amazon FPS?
|
# set -- sandbox or production Amazon FPS?
|
||||||
#AMAZON_FPS_HOST = "fps.sandbox.amazonaws.com"
|
#AMAZON_FPS_HOST = "fps.sandbox.amazonaws.com"
|
||||||
|
|
Loading…
Reference in New Issue