How to display models.full_clean() ValidationError in django admin?

31 views
Skip to first unread message

ivory 954

unread,
Feb 23, 2022, 12:14:25 AM2/23/22
to Django users
Copy from:
https://stackoverflow.com/questions/71231549/how-to-display-models-full-clean-validationerror-in-django-admin

Question:
    try: 
        article.full_clean()
    except ValidationError as e:
        # Do something based on the errors contained in e.message_dict. 
        # Display them to a user, or handle them programmatically. 
     pass

There tell us can Display them to a user, how to display errors in Admin?

When I do nothing:

  • When Settings.py Debug = True, it always render a ValidationError at /admin/xxx/xxx/xxx/change/ page.
  • When Settings.py Debug = False, it always render a HTTP 500 page.
Reply all
Reply to author
Forward
0 new messages