I am developing a generic application. Let's assume that it handles Foo objects which can be attached to any model.
In a template, a Foo form can be shown by the get_foo_form
template tag:
{% get_foo_form for object as form %}
object is the object which foo will be attached to.
The form posts to a view in the foos application. if the form is valid, everything is fine. the new foo is saved and the view redirects to the former page (via a 'next' argument hidden in the form) and the new foo is displayed nicely.
But if the form is not valid, I'm lost. For the same case, a similar application, the django.contrib.comments has an intermediary page that asks the user to correct the errors. However, I don't want to display an intermediary page, I want to show the former page with the errors. A redirection does not suffice here as I need to pass the error message(s) to the former page.
Is there a way to accomplish what I'm trying to do, or should I change the whole structure?