Mercurial > public > sg101
diff gpp/messages/views.py @ 178:d51743322bb2
#56 - Cut over to Django 1.2 messaging system.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 17 Mar 2010 03:12:05 +0000 |
parents | 7ad1f3e77cd9 |
children | c8c0fa817a05 |
line wrap: on
line diff
--- a/gpp/messages/views.py Mon Mar 15 03:26:38 2010 +0000 +++ b/gpp/messages/views.py Wed Mar 17 03:12:05 2010 +0000 @@ -5,6 +5,7 @@ from django.template import RequestContext from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required +from django.contrib import messages from django.shortcuts import get_object_or_404 from django.core.urlresolvers import reverse from django.http import Http404 @@ -109,7 +110,7 @@ compose_form = ComposeForm(request.user, request.POST) if compose_form.is_valid(): compose_form.save(sender=request.user, parent_msg=msg) - request.user.message_set.create(message='Reply sent.') + messages.success(request, 'Reply sent.') return box_redirect(request) else: if msg.receiver == request.user: @@ -145,7 +146,7 @@ compose_form = ComposeForm(request.user, request.POST) if compose_form.is_valid(): compose_form.save(sender=request.user) - request.user.message_set.create(message='Message sent.') + messages.success(request, 'Message sent.') return HttpResponseRedirect(reverse('messages-inbox')) else: if receiver is not None: @@ -177,7 +178,7 @@ else: raise Http404 msg.save() - request.user.message_set.create(message='Message sent to trash.') + messages.success(request, 'Message sent to trash.') return box_redirect(request) @@ -204,7 +205,7 @@ elif msg.receiver == request.user: msg.receiver_delete_date = now msg.save() - request.user.message_set.create(message='Messages sent to the trash.') + messages.success(request, 'Messages sent to the trash.') return box_redirect(request) @@ -224,7 +225,7 @@ else: raise Http404 msg.save() - request.user.message_set.create(message='Message retrieved from the trash.') + messages.success(request, 'Message retrieved from the trash.') return box_redirect(request) @@ -250,7 +251,7 @@ elif msg.receiver == request.user: msg.receiver_delete_date = None msg.save() - request.user.message_set.create(message='Messages retrieved from the trash.') + messages.success(request, 'Messages retrieved from the trash.') return box_redirect(request) @@ -267,7 +268,7 @@ form = OptionsForm(request.POST, instance=options) if form.is_valid(): form.save() - request.user.message_set.create(message='Options saved.') + messages.success(request, 'Options saved.') return HttpResponseRedirect(reverse('messages-inbox')) else: try: