On Wed, Sep 30, 2009 at 4:14 PM, willfe <wil...@gmail.com> wrote:

>
> Greetings!
>
> I'm trying to follow through the example shown at
> http://docs.djangoproject.com/en/dev/topics/auth/#messages to pass one
> or more messages to a user when saving a form. I'm using the 1.1
> release.
>
> I've made sure the view calls:
>
> request.user.message_set.create(message = u"Hi there!")
>
> and according to django-debug-toolbar, the message is getting stored,
> retrieved, and removed like it should be. The trouble is the message
> never shows up in the rendered page, despite the presence of this
> blurb in the template (lifted straight from the documentation):
>
> {% if messages %}
> <ul>
>    {{ messages }}
>    {% for message in messages %}
>    <li>{{ message }}</li>
>    {% endfor %}
> </ul>
> {% endif %}
>
> The infuriating part is the debug toolbar actually *shows the message*
> in the template context, in an attribute called 'messages'.
>

If this template snippet is contained in a child template, is it somewhere
within a {% block %} tag?



> django.core.context_processors.auth shows an empty 'messages' list,
> though.


I'm not sure what you are saying here.  What are you looking at (and when),
exactly, that leads you to say 'auth' shows an empty messages list?


> If I set SHOW_TEMPLATE_CONTEXT to False in the debug toolbar's
> configuration (I did this on the (apparently false) hope that perhaps
> *its* evaluation/exploring of the context was invoking
> get_and_delete_messages() and discarding/not passing the results), the
> symptom remains.
>
> I've got to be missing something obvious :(
>
> Anybody have any ideas? Thanks in advance for any help.
>
>
I've usually found that data mysteriously not appearing in templates despite
the context containing the proper values is caused by mistakenly putting
things outside of block tags in child templates.

Karen

--~--~---------~--~----~------------~-------~--~----~
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 
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