﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30376	Saving ModelForm with missing, non-optional fields does not trigger a validation error	Will Gordon	nobody	"I have my model

{{{#!python
class Meeting(models.Model):
    title = models.CharField(max_length=255, help_text='A short header for your meeting')
    summary = models.TextField(help_text='An overview of the meeting. You\'ll have the opportunity to add specific notes later on')
    outcome = models.TextField(help_text='What was the final conclusion to the meeting')
    attended = models.DateField(help_text='When did you attend this meeting')
    attendees = models.ManyToManyField(Person, related_name='meetings')
    companies = models.ManyToManyField(Company, related_name='meetings')
    industries = models.ManyToManyField(Industry, related_name='meetings')
    author = models.ForeignKey(Person, on_delete=models.SET_NULL, related_name='my_meetings', null=True)
}}}

and my form

{{{#!python
class MeetingForm(forms.ModelForm):
    class Meta:
        model = models.Meeting
        fields = ['author', 'attended', 'attendees', 'companies', 'industries', 'outcome']
}}}

Because `title`, and `summary` are not listed in my form's `fields`, I would expect this form to never be savable.

This was a result of my merging of two models, I updated the Model, but not the Form. I was surprised when I was then able to save the Form.

Based on documentation from https://docs.djangoproject.com/en/2.1/topics/forms/modelforms/#selecting-the-fields-to-use

  Django will prevent any attempt to save an incomplete model, so if the model does not allow the missing fields to be empty, and does not provide a default value for the missing fields, any attempt to save() a ModelForm with missing fields will fail. 

I would expect the validation to fail since there is no default value provided.

This is either a docs bug, with the form validation working as expected (not validating any fields explicitly excluded)...or a form validation bug, where the form should still validate all Model fields to ensure it's not saving blank fields."	Bug	closed	Documentation	dev	Normal	invalid			Unreviewed	0	0	0	0	0	0
