Re: Django 1.4 - how to display a success message on form save
@newkedison, thank you for the suggestion. I wish to stay on the page without doing any redirects.
@Jirka - thanks. I saw something about the messaging framework and even tried one example which did not work.
I ended up doing the following (which worked):
In view:
success = default value here
if form.is_valid():
form.errors['success'] = 'Saved'
....
return self.render_to_response(request, template_name, {
'tomatoes': tomatoes,
'success': success,
})
... and in template:
<p>{{ success }}</p>
Regards.
--
Regards,
Sithembewena Lloyd Dube
-- On Tue, Jun 26, 2012 at 2:20 PM, Jirka Vejrazka <jirka.vejrazka@gmail.com> wrote:
Hi,
have you checked the messaging framework in Django?
HTH
Jirka
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Regards,
Sithembewena Lloyd Dube
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home