﻿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
28387	Disabled fields should not be considered changed in bound forms	Kevin Corbin	Srinivas Reddy Thatiparthy	"This is similar to #27431, but that ticket only modified the has_changed method in the base django.forms.fields.Field class.

Other form field classes included in django.forms.fields and django.forms.models override the base class' has_changed method, so aren't checking for the disabled attribute when determining whether or not a bound form field's data has changed.

As of Django 1.11.3, the following are affected: 
*django.forms.fields.BooleanField
*django.forms.fields.MultipleChoiceField
*django.forms.fields.MultiValueField
*django.forms.fields.FileField
*django.forms.models.ModelChoiceField
*django.forms.models.ModelMultipleChoiceField

Here is an example form class that exhibits this behavior:
{{{#!python
from django.contrib.auth import get_user_model
class MyTestForm(forms.Form):
    test_disabled = forms.ModelChoiceField(disabled=True, 
                                           queryset=get_user_model().objects.all(), 
                                           initial=get_user_model().objects.first().id)
}}}

From the console I show the bug as such:
{{{#!python
form = MyTestForm(data={})
form.is_bound #True
form.has_changed() #True
form.changed_data #['test_disabled']
}}}"	Bug	closed	Forms	1.11	Normal	fixed			Accepted	1	0	0	1	0	0
