This is a sort of solution: A ChoiceField is populated at render time
by data either called from the ModelForm relationship or from a
ModelChoiceField lookup, and populates the HTML select field on the
form. It is this instance that is validated. Populating the choices
dictionary therefore deletes the data from the lookup:
class ProductForm(ModelForm):
prodsubcat = forms.ModelChoiceField(ProductSubCategory.objects,
widget=forms.Select(attrs={'disabled': 'true'}), choices =(('-1',
'Select Top Category'),))
and breaks the validation.
If the field is rendered without the choices dictionary, but with the
'disabled' attribute, it will display as a disabled select field.
Selecting an option from the prodtopcat select field calls the Ajax
lookup, which populates the prodsubcat field with filtered data in the
browser, but not in the field object. Selecting a category from the
prodsubcat field returns an option that can be validated from the
field object.
Simon