Would Django itself ever raise ValidationError in Model.save()?

I wonder how you propose converting something like an IntegrityError from 
the database into an "friendly" exception for the user?

On Wednesday, November 25, 2015 at 9:23:05 AM UTC-5, Vlastimil Zíma wrote:
>
> Django assumes that all input data in forms can be validated by 
> `Form.is_valid()` which in some cases is not true. Database contraints, 
> e.g. unique, can fail even though they are checked. An application may 
> require communication with other servers while processing data which can 
> lead to errors. But these conditions are not expected by regular Django 
> form flow and an attempt to handle these cases results in large overriding 
> of default implementation.
>
>
> This topic was previously discussed here 
> https://groups.google.com/d/topic/django-developers/rzjpP0byNQo/discussion, 
> but discussion was mainly based on race condition in unique check. I'd like 
> to reopen the topic because there are other possibilities which may cause 
> the possibility of failure after form validation to become real, especially 
> if network connection is involved.
>
>
> I suggest Django should provide mechanism which allow handling the 
> unexpected failures after form validation, e.g. expect `ValidationError` to 
> be raised by `ModelAdmin.save_model`.
>
>
> I started this discussion as a result of wontfix from 
> https://code.djangoproject.com/ticket/25777.
>
>
> Vlastik
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1db10ddc-eae6-4f17-a596-b8ce1aa8ef1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to