Why does my excluded field still appear in this Django form?
问题 I'm using exclude in my form's Meta class to exclude a field from my form that I want to fill in programatically, but it's still showing up in the form. Here are some excerpts from the code: # Model class Info(models.Model): completed_by = models.ForeignKey(User, related_name='+') # Form class InfoForm(forms.ModelForm): class Meta: model = Info exclude = ('created_by',) #ETA: added comma to make this a tuple widgets = { 'some_other_field': forms.HiddenInput(), 'some_other_field2': forms