And if it is valid, then that's good. ), but it can still render the blank form as HTML. I Django forms, it can check whether the form is valid: if form.is_valid(): return HttpResponseRedirect('/thanks/') But I'm missing what to do if it isn't valid? unbound form creation, call to is_valid()). But similar to regular Django form processing, once a form is valid -- if is_valid() returns True-- you'll want do something with the contents Django form.is_valid() always false Ask Question Asked 6 years, 5 months ago Active 6 years, 5 months ago Viewed 13k times 15 2 I'm coding a login. If it’s unbound, it cannot do validation (because there’s no data to validate! If you want to customize this process, there are various places to make changes, each one serving a different purpose. form_valid() is not what it's for. Im trying to send a file over to another server once it is chosen in upload, but is form.is_valid() always return false would not let me enter if views.py- def Form and field validation Form validation happens when the data is cleaned. 1 from django.core import validators 2 class TextForm(forms.Form): 3 # slug指有效URL的一部分,能使URL更加清晰易懂 4 slug = forms.CharField(validators= [validators.validate_slug], 6 error_messages={' required ': '不能为空 ' 7}) Three types of cleaning methods are run during form processing. If it’s bound to a set of data, it’s capable of validating that data and rendering the form as HTML with the data displayed in the HTML. I am a bit new to django. I'm following a Django Course about user authentication and authorisation. @GSNGamesAlexr It's not in the django docs because you really shouldn't do this in form_valid at all. How do I return the form When I programmed the form by hand I got it working. June 20, 2019 These days websites have become highly personalized resulting to some awesome applications for users. Form handling with class-based views Form processing generally has 3 paths: Initial GET (blank or prepopulated form) POST with invalid data (typically redisplay form with errors) POST with valid data (process the data and typically redirect) Implementing this). Bound and unbound forms A Form instance is either bound to a set of data, or unbound. The remaining form structures in listing 6-36 are identical to regular non-file forms (e.g. from my undestanding, I wanted it to always redirect to the main page even if the form is not valid because then I would be able to display the errors in the form on the main page right?