On Thursday, 9 November 2017 16:37:50 UTC, Matthew Pava wrote:

> I don’t use Field.validators much myself, but it seems that the Form clean 
> method also calls Field.validators, so the redundancy is already there in 
> the Form class.  For consistency’s sake, I suggest we either add 
> Model.clean_fieldname(), or we remove Form.clean_fieldname().  Both 
> suggestions would certainly have issues with backwards compatibility.
>
>
I don't think that Form.clean_fieldname() shouldn't be removed. Validators 
only check whether the value is valid or not. They do not allow you to 
modify the value (e.g. "return value.strip()" to remove leading/trailing 
whitespace).

I think that adding Model.clean_<fieldname> would be useful, and would make 
it more consistent with the form validation. However, backwards 
compatibility is an issue as Jonas mentioned.

cheers,
Alasdair

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b96a7405-74f8-41cc-af5e-00a7e0889eac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to