I've given up waiting and trying. I have a hack in the form of a template tag:
{% if request.session.good_message_box %} <ul class="errorlist"> {% for m in request.session.good_message_box %} <li>{{ m }}</li> {% endfor %} </ul> {% empty_messages "good_message_box" %} <<<<<< {% endif %} @register.tag() def empty_messages(parser, token): try: # split_contents() knows not to split quoted strings. tag_name, message_box = token.split_contents() except ValueError: raise template.TemplateSyntaxError, "%r tag requires a single MessageBox name." % token.contents.split()[0] if not (message_box[0] == message_box[-1] and message_box[0] in ('"', "'")): raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name return EmptyMessagesNode(message_box[1:-1]) class EmptyMessagesNode(template.Node): def __init__(self, message_box): self.message_box = message_box def render(self, context): try: s = SessionStore(context['request'].session.session_key) if self.message_box in s.keys(): s[self.message_box].messages = [] s.save() return '' except template.VariableDoesNotExist: return '' Obviously I'd rather not ask my web server to do all this 3 times (good, bad and neutral messages) for each page view. If anyone knows anything about the problem I've outlined, or has a better suggestion than my hack, please do post. On Dec 16, 3:50 pm, itpaul <[EMAIL PROTECTED]> wrote: > ok. i made a change which includes your modified-true suggestion and > a possibly relevant solution found here: > > http://code.djangoproject.com/wiki/NewbieMistakes#Appendingtoalistins... > > if 'good_message_box' not in request.session: > request.session['good_message_box'] = MessageBox(sort='good') > mb = request.session['good_message_box'] > mb.messages.append('MessageBox: You have successfully logged in.') > request.session['good_message_box'] = mb > request.session.modified = True > > It still doesn't work :( The behaviour is unchanged. > > On Dec 16, 8:16 am, SmileyChris <[EMAIL PROTECTED]> wrote: > > > On Dec 16, 2:13 pm, itpaul <[EMAIL PROTECTED]> wrote: > > > > 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. > > > Most likely, the session isn't getting > > saved.http://www.djangoproject.com/documentation/sessions/#when-sessions-ar... > > > For the lazy: > > request.session.modified = True --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---