Permalink
Browse files

Merge pull request #297 from kevinslin/master

Fixed some bugs with umessage class based views
  • Loading branch information...
2 parents 6123415 + 44874e1 commit 13edb3cd5613cc022d5f887f734b36f0e3c7256c @wunki wunki committed Mar 18, 2013
@@ -1,6 +1,8 @@
from django.db import models
from django.db.models import Q
+from userena.contrib.umessages import signals
+
import datetime
class MessageContactManager(models.Manager):
@@ -77,6 +79,7 @@ def send_message(self, sender, to_user_list, body):
# Save the recipients
msg.save_recipients(to_user_list)
msg.update_contacts(to_user_list)
+ signals.email_sent.send(sender=None,msg=msg)
return msg
@@ -0,0 +1,3 @@
+from django.dispatch import Signal
+
+email_sent = Signal(providing_args=["msg"])
@@ -25,24 +25,25 @@ class MessageListView(ListView):
page=1
paginate_by=50
template_name='umessages/message_list.html'
- extra_context=None
- context_object_name = 'message'
+ extra_context={}
+ context_object_name = 'message_list'
+
+ def get_context_data(self, **kwargs):
+ context = super(MessageListView, self).get_context_data(**kwargs)
+ context.update(self.extra_context)
+ return context
def get_queryset(self):
return MessageContact.objects.get_contacts_for(self.request.user)
-class MessageDetailListView(ListView):
+class MessageDetailListView(MessageListView):
"""
Returns a conversation between two users
"""
- page=1
- paginate_by=50
template_name='umessages/message_detail.html'
- extra_context=None
- context_object_name = 'message'
def get_context_data(self, **kwargs):
context = super(MessageDetailListView, self).get_context_data(**kwargs)

0 comments on commit 13edb3c

Please sign in to comment.