I wonder if you have any ideas on this
I present messages as below - it works great, when there is an error it shows the error.
But, how do I retain these messages - so the user can see all of the errors they had since their session started?
I.e. if I working for a while, I might want to review all my form validation failures at the end.
Thanks
messages.error(request, ('ERROR: Your milestone was not created. Milestone points must be numeric. Please try again.'))
CodePudding user response:
Maybe Django's Sessions.
https://docs.djangoproject.com/en/3.2/topics/http/sessions/#using-sessions-in-views
def message_error(request, msg):
errors = request.session.get('errors', []):
errors.append(msg)
request.session['errors'] = errors
messages.error(request, msg)
def get_message_error_list(request):
return request.session.get('errors', [])