Copy from:
https://stackoverflow.com/questions/71231549/how-to-display-models-full-clean-validationerror-in-django-admin

Question:

https://docs.djangoproject.com/en/4.0/ref/models/instances/#validating-objects
from django.core.exceptions import ValidationError
    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.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1bc61c0c-a80a-468a-87d6-4d1f6715e2b5n%40googlegroups.com.

Reply via email to