Thanks, Mick. This will work well and I think is the "right" way to go
about this.

On Jul 8, 8:32 am, Mick <souldrink...@gmail.com> wrote:
> I've encountered same issue. My solution is simple model and
> middleware:
>
> class OfflineNotification(models.Model):
>     user = models.ForeignKey(User)
>     message = models.TextField()
>     level = models.PositiveSmallIntegerField(default=20)
>     created = models.DateTimeField(auto_now_add=True)
>
> class OfflineNotificationsMiddleware:
>
>     def process_request(self, request):
>         if request.user.is_authenticated():
>             notifications =
> OfflineNotification.objects.filter(user=request.user).distinct('message')
>             for notification in notifications:
>                 messages.add_message(request, notification.level,
> notification.message)
>
>             if notifications:
>
> OfflineNotification.objects.filter(user=request.user).delete()
>
> Hope it will help you.
>
> On Jul 8, 12:27 am, jyunis <njyu...@gmail.com> wrote:
>
> > Hey all,
>
> > I'm currently developing an application using Django's deprecated user
> > messaging functionality and one of the features I depend on is the
> > ability to set messages for a particular user from a back-end process,
> > i.e. outside of the request cycle.  In my backend process, I have
> > access to the User object, but of course not the request object.
>
> > I see that the new Django 1.2 message framework does not support this,
> > but I am wondering if that use case has been addressed in any other
> > way.  I hate to continue development using a deprecated feature, but
> > the lack of offline messaging from the message framework is a
> > significant barrier to migration.
>
> > --
> > Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to