Add some extra metadata to notifications
This commit is contained in:
@@ -2,6 +2,7 @@ from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
import api
|
||||
from notification import models as notification
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from django.dispatch import dispatcher
|
||||
|
||||
@@ -55,7 +56,7 @@ class Award(models.Model):
|
||||
def save(self, *args, **kwargs):
|
||||
super(Award, self).save(*args, **kwargs)
|
||||
api.badge_awarded.send_robust(sender=intern(str(self.badge.slug)), award=self)
|
||||
notification.send([self.user], "badge_awarded", {"award": self})
|
||||
notification.send([self.user], "badge_awarded", {"award": self, 'notice_description': self.badge, 'notice_url': reverse('user_profile')})
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s for %s"%(self.badge.__unicode__(), self.user.__unicode__())
|
||||
|
@@ -40,7 +40,7 @@ def reply(request, topicID=None):
|
||||
reply.body = form.cleaned_data['body']
|
||||
reply.user = request.user
|
||||
reply.save()
|
||||
notification.send([reply.parent.user], "forum_reply", {"reply": reply})
|
||||
notification.send([reply.parent.user], "forum_reply", {"reply": reply, 'notice_url': reverse('forums.views.post', kwargs={'id':reply.id}), 'notice_description': reply.topic().title})
|
||||
messages.info(request, "Reply successful")
|
||||
return HttpResponseRedirect(reverse('forums.views.post', kwargs={"id":reply.id}))
|
||||
return render_to_response('forums/reply.html', {"post":parentPost, "form":form}, context_instance = RequestContext(request))
|
||||
|
1
templates/notification/notice.html
Normal file
1
templates/notification/notice.html
Normal file
@@ -0,0 +1 @@
|
||||
{% load i18n %}{% if notice_url %}<a href="{{notice_url}}">{%endif%}{% blocktrans %}{{ notice }}{%endblocktrans%}{% if notice_description %}: {{ notice_description }}{% endif %}{%if notice_url %}</a>{%endif %}
|
Reference in New Issue
Block a user