[Answered ]-Django: If I pass an instance to a form, then call is_valid(), are the instances fields validated?


No, the form doesn’t even contain the username field if it has been excluded.

If you want to perform validation on the field through the form, you should modify the POST dictionary.

post = request.POST.copy()
post['username'] = 'Foobar'

form = ExampleForm(post)

Leave a comment