I have a view that validates and saves a form. After the form is saved, I\'d like redirect back to a list_object view with a success message \"form for customer xyz was suc
To expand on Antoine's helpful answer: if you want to process the messages in your views module, rather than the template:
from django.contrib.messages import get_messages
def my_view(request):
# Process your form data from the POST, or whatever you need to do
# Add the messages, as mentioned above
messages.add_message(request, messages.INFO, form.cleaned_data['name'])
return HttpResponseRedirect('/other_view_url/')
def other_view(request):
storage = get_messages(request)
name = None
for message in storage:
name = message
break
return render(request, 'general/other_view.html', {'name': name})