I have the following test...
def test_contact_form(self):
form_data = {'name': 'Reiss Johnson',
'email': 'reissjohnson@test.com',
'_type': 'General Enquiry',
'content': 'This is some content'}
form = ContactForm(data=form_data)
self.assertTrue(form.is_valid())
This was originally passing as '_type' was a CharField, however it is now a ModelChoiceField & so does anybody know why this is failing? Im guessing im inputting the '_type' into the dictionary incorrectly now?
How could I get the above test to pass again?
My form is as so...
class ContactForm(forms.Form):
name = forms.CharField(max_length=50)
email = forms.EmailField()
content = forms.CharField()
_type = forms.ModelChoiceField(queryset=EnquiryType.objects.values_list('text', flat=True), empty_label=None)