[Fixed]-Django field error messages


I’m not sure why the error message has the u'' prefix. I suggest you change the value of the choice to the empty string ''.

class TravelGeneralEnquiryChildForm(forms.ModelForm):
    age = forms.ChoiceField(choices=(('','-'),) + tuple(((str(x), x) for x in range(0, 18))))

That way you’ll get the error message This field is required. instead of the invalid choice error message.

Leave a comment