1
This model form saved my life. The MyModelChoiceField class shows the label but send id on the backend.
class MyModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return obj.description
class TmpFormm(forms.ModelForm):
pos_code = MyModelChoiceField(queryset=Positions.objects.all(), widget=forms.Select(attrs={'class': 'select2_single form-control', 'blank': 'True'}))
Source:stackexchange.com