now notifications actually get sent. cleanup to follow.

pull/1/head
Andromeda Yelton 2012-04-02 15:04:51 -04:00
parent 679f797b74
commit e197cd6acc
3 changed files with 7 additions and 13 deletions

View File

@ -74,7 +74,7 @@ signals.post_syncdb.connect(create_notice_types, sender=notification)
# define the notifications and tie them to corresponding signals
from django.contrib.comments.signals import comment_was_posted
from django.contrib.comments.signals import comment_was_posted
def notify_comment(comment, request, **kwargs):
logger.info('comment %s notifying' % comment.pk)
@ -92,15 +92,13 @@ def notify_active_campaign(sender, **kwargs):
# what sort of error handling do I need to do here? any?
# how do I both ensure that the status is active AND that it was just made active?
# do i need to send that with the signal?
# let's do the basic version for now and then ask for guidance on style, error-checking
# logging?
campaign = kwargs.get('instance')
print "i'm in ur function launchin ur "+campaign.name
work = campaign.work
# assumes only one active claim per campaign. safe?
rightsholder = work.claim.filter(status="active")[0].rights_holder.rights_holder_name
# is this distinct?
ungluers = work.wished_by()
notification.queue(ungluers, "active_campaign", {'campaign':campaign, 'work':work, 'rightsholder':rightsholder}, True)
emit_notifications.delay()
import regluit.core.tasks as tasks
tasks.emit_notifications.delay()
signals.post_save.connect(notify_active_campaign, sender=Campaign)

View File

@ -2,15 +2,11 @@ Congratulations, you wished for it, and now there is an active Campaign for {{ w
You can help!
{% comment %}
<a href="https://{{ site.domain }}/pledge/{{ work.id }}">Pledge</a> toward ungluing.
<a href="{% url pledge work_id=work.id %}">Pledge</a> toward ungluing.
Tell your friends -- there are handy share options on the <a href="https://{{ site.domain }}/work/{{ work.id }}">campaign page</a>. There's even a widget you can put on your blog or home page.
Tell your friends -- there are handy share options on the <a href="{% url work work.id %}">campaign page</a>. There's even a widget you can put on your blog or home page.
<a href="https://{{ site.domain }}/work/{{ work.id }}?tab=2">Join the discussion</a>: share why you love {{ work.title }} and the world will too.
i'm pretty sure the slashes are breaking the send
{% endcomment %}
<a href="{% url work work.id %}?tab=2">Join the discussion</a>: share why you love {{ work.title }} and the world will too.
Thank you!

View File

@ -1,6 +1,6 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work id %}"><img src="{{ work.cover_image_thumbnail }}" alt="cover image for {{ work.title }}" /></a>
<a href="{% url work work.id %}"><img src="{{ work.cover_image_thumbnail }}" alt="cover image for {{ work.title }}" /></a>
</div>
<div class="comments_info">