Sounds like you're not updating/removing items from the MessageBox object, as I don't see where you are removing items from the list (I see no calls to MessageBox.next() being made).
Alternatively, wouldn't the messaging system in the Authentication framework fit your needs? Your implementation highly resembles it... Hope it helps, IdNotFound On Dec 15, 2007 11:13 PM, itpaul <[EMAIL PROTECTED]> wrote: > > This model works in the shell. It holds messages and pops items off as > it iterates: > > class MessageBox: # also tried with (models.Model) > > def __init__(self, sort='neutral'): > self.sort = sort > self.messages = [] > > def __iter__(self): > return self > > def next(self): > if len(self.messages) == 0: > raise StopIteration > return self.messages.pop() > > > > I have this in my view to add a MessageBox object to the session and > then add a message to it: > > if 'good_message_box' not in request.session: > request.session['good_message_box'] = MessageBox(sort='good') > request.session['good_message_box'].messages.append('MessageBox: > You have successfully logged in.') > > > > I have this in my template to dispaly the messages: > > {% if request.session.good_message_box %} > <ul class="errorlist"> > {% for m in request.session.good_message_box %} > <li>{{ m }}</li> > {% endfor %} > </ul> > {% endif %} > > > However, unlike the shell behaviour which lists and deletes messages, > the template lists and retains the messages resulting in them > displaying repeatedly on every page (the template code is part of my > base template). Its as if my iterator is being ignored. I have tried > file based sessions and db based. > > Am I missing something or can you not utilise objects in > request.session? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---