Re: Why does ModelForm do validation and not Model

2019-04-19 Thread René Fleschenberg
Hi On 4/18/19 2:07 PM, Václav Řehák wrote: >  As a veteran Django user, I am quite used to it but as I work on > financial project (with strong requirements on data consistency) with a > team of senior developers kind of new to Django I face a lot of > confusion about why does Django let us save

Re: Why does ModelForm do validation and not Model

2019-04-18 Thread Tobias Kunze
On 19-04-18 05:07:53, Václav Řehák wrote: >If it was possible, e.g. in settings, to force model >validation in save(), it would help us a lot. Would it help you even if this would only apply to actual `save()` calls, no bulk creates, no bulk updates, and no modifications of m2m relationships via

Re: Why does ModelForm do validation and not Model

2019-04-18 Thread Václav Řehák
Dne čtvrtek 18. dubna 2019 10:56:55 UTC+2 Aymeric Augustin napsal(a): > > Le mer. 17 avr. 2019 à 22:32, Curtis Maloney > a écrit : > > > It's mostly for performance reasons, since validation can be expensive. >> >> Really? My memory was that it was (a) backward compatibility [model >>

Re: Why does ModelForm do validation and not Model

2019-04-18 Thread Aymeric Augustin
Hi Curtis, Le mer. 17 avr. 2019 à 22:32, Curtis Maloney a écrit : > It's mostly for performance reasons, since validation can be expensive. > > Really? My memory was that it was (a) backward compatibility [model > validation was added later], and (b) practicality [try catching > everywhere in

Re: Why does ModelForm do validation and not Model

2019-04-17 Thread Curtis Maloney
On 4/17/19 4:55 AM, Aymeric Augustin wrote: Hello Will, It's mostly for performance reasons, since validation can be expensive. Really? My memory was that it was (a) backward compatibility [model validation was added later], and (b) practicality [try catching everywhere in your code you

Re: Why does ModelForm do validation and not Model

2019-04-16 Thread Will Gordon
Ahh, cool. That makes more sense. I worry that it still leaves open the potential of accidentally not validating something. It may make more sense to offer instance.save(validate=False) instead of relying on the developer to always know whether they can trust the input. But I agree that for

Re: Why does ModelForm do validation and not Model

2019-04-16 Thread Tom Forbes
The idea is that you generally always have to do extensive validation when accepting user input through a form. These validations could require additional database queries or other somewhat expensive lookups (especially with validate unique). However if you are loading data from a trusted source,

Re: Why does ModelForm do validation and not Model

2019-04-16 Thread Will Gordon
So the validation is cheaper when performed by ModelForm, as opposed to the Model? -- 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

Re: Why does ModelForm do validation and not Model

2019-04-16 Thread Aymeric Augustin
Hello Will, It's mostly for performance reasons, since validation can be expensive. You can override save() to call full_clean() in a model if you'd like. Cheers, -- Aymeric. > On 16 Apr 2019, at 20:47, Will Gordon wrote: > > I can't seem to find a good reason for this. And I could

Why does ModelForm do validation and not Model

2019-04-16 Thread Will Gordon
I can't seem to find a good reason for this. And I could foresee this preventing potential mistakes. I'm not proposing to actually change the implementation, I guess I'm just looking for the reason of it. -- You received this message because you are subscribed to the Google Groups "Django