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 deve

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 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 his

Force "required" fields to be included in a ModelForm

2019-04-16 Thread Will Gordon
In the same way that editable fields are forced to not be included in a ModelForm ( https://github.com/django/django/blob/master/django/forms/models.py#L146), I would like to propose that "required" fields (`blank=False`) be forced to be included in a ModelForm. While I understand that a develo

Re: Force "required" fields to be included in a ModelForm

2019-04-16 Thread Will Gordon
Sorry if I wasn't more clear, but using a warning was exactly what I was proposing. In the same way that a FieldError is raised when an editable field is listed in fields, I was essentially planning on doing the exact same check on the blank attribute. I agree that this should be ignorable, and

Re: Force "required" fields to be included in a ModelForm

2019-04-16 Thread Will Gordon
I can certainly agree that there may be some use cases where it should be possible to disable this functionality, but I would argue that erroring on a missing, required field should be the default, and allow for a way to override...as opposed to allowing missing fields and requiring a workaround

Re: Force "required" fields to be included in a ModelForm

2019-04-16 Thread Will Gordon
Would it be weird to just make it so that the "required" field *must* be present in exclude? This way, if you *accidentally* leave off a required field, you're quickly notified about itbut if you explicitly mark it as something to exclude, it makes it clear to everyone exactly what you're t

Re: Force "required" fields to be included in a ModelForm

2019-04-17 Thread Will Gordon
Well shoot...this definitely seems like something only I'm running into. Appreciate y'alls feedback. Thanks 👍🏻 -- 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 receiv