Hi, I'm writing a view to create a model, and am trying to capture any ValidationErrors and display them to the user. I have code that looks like this:
# exceptions is a dict of errors already encountered try: # create model except ValidationError as e: for key, msg in e.message_dict.items(): exceptions.update({key: str(msg[0])}) I'm getting the following error: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 114, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/rmcclosk/Documents/Shipyard/shipyard/method/views.py", line 529, in method_revise for key, msg in e.message_dict.items(): File "/usr/local/lib/python2.7/dist-packages/django/core/exceptions.py", line 96, in message_dict for field, messages in self.error_dict.items(): AttributeError: 'ValidationError' object has no attribute 'error_dict' This looks like a Django bug to me, but I googled around and couldn't find anything similar. The same error also happens if I just try to print(e.message_dict) instead of iterating through it, it seems like just accessing message_dict is causing the problem. Any ideas about what could be wrong? Thanks! -- 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/c1cfd882-6241-4ce7-9c74-c2dd6c05b915%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.