But the message gets displayed only after I reload the page, the page isn't updated.
On Tuesday, 26 June 2012 08:46:04 UTC-4, JirkaV wrote: > > >> @Jirka - thanks. I saw something about the messaging framework and even > >> tried one example which did not work. > > Using the messaging framework is actually very simple. > > You need to enable the messaging framework (see the steps here: > https://docs.djangoproject.com/en/1.4/ref/contrib/messages/ ) > > In your template, you need this (I have that in my base template so > it's included in all pages): > > {% if messages %} > {% for message in messages %} > {{ message }} > {% endfor %} > {% endif %} > > Obviously, you'll need some formatting/CSS around it. > > And in your views.py (or forms.py, ...) > > from django.contrib import messages > > if form.is_valid(): > messages.success(request, 'Your form was saved') > > And that's it! > > > Jirka > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a76615b9-077a-4ccb-a278-158e1cd7f755%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.