form.is_valid() is always return false please help

897 views
Skip to first unread message

Shubham Chauhan

unread,
Aug 22, 2019, 3:56:56 PM8/22/19
to Django users
form.is_valid() is always return false please help 
Screenshot (78).png

Thomas Lockhart

unread,
Aug 22, 2019, 5:20:36 PM8/22/19
to django...@googlegroups.com
Post your form code please.

- Tom

On Aug 22, 2019, at 12:56 PM, Shubham Chauhan <shubham.c...@gmail.com> wrote:

form.is_valid() is always return false please help 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/206e042a-738b-4491-8f4d-9c172f61e56d%40googlegroups.com.
<Screenshot (78).png>

Shubham Chauhan

unread,
Aug 23, 2019, 4:48:56 AM8/23/19
to django...@googlegroups.com

mohammad mehrani

unread,
Aug 24, 2019, 3:01:44 PM8/24/19
to django...@googlegroups.com
awesome!!! and i like it

On Fri, Aug 23, 2019 at 12:27 AM Shubham Chauhan <shubham.c...@gmail.com> wrote:
form.is_valid() is always return false please help 

--

vineeth sagar

unread,
Aug 24, 2019, 3:02:50 PM8/24/19
to django...@googlegroups.com
What does form.errors show. Just see what print(form.errors) tells you. It should be pretty obvious.

Abu Yusuf

unread,
Aug 25, 2019, 1:11:57 AM8/25/19
to django...@googlegroups.com
Some of the input fields aren't valid. We need to show the forms.py and the template code.

Then it will be more clear.

Ajeet Kumar Gupt

unread,
Aug 25, 2019, 3:48:29 AM8/25/19
to django...@googlegroups.com, shubham.c...@gmail.com
Hi,

Please check the below solution.


image.png

On Thu, Aug 22, 2019 at 11:57 PM Shubham Chauhan <shubham.c...@gmail.com> wrote:
form.is_valid() is always return false please help 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/206e042a-738b-4491-8f4d-9c172f61e56d%40googlegroups.com.


--






Thanks & Regards
Ajeet Kumar Gupt
+91-9311232332

Sundararajan Seshadri

unread,
Aug 25, 2019, 6:59:20 AM8/25/19
to Django users
If the issue is already resolved, ignore my update. 

A little lengthy response, so that you can appreciate the full picture. 

form-is_valid() is purely to do with the definition of the specific form - or rather the definition of the fields in the form. Because that is the only information known to Django. Now this form may come from a generic (unbound - that is not, linked to any database table) form or a form linked to a table. So you need to look at the definitions or validation as defined in the definition of the fields in the form or the underlying table. Some validations may be done by HTML itself (e.g. number) and the browser will catch them on its own. Whatever values are passed on by the browser to Django will first be validated (when you call form.is_valid()) as per the definitions / validations known to it.

Normally if is_valid() function returns False, the errors get attached to the respective fields and you need to show them. In the HTML associated with the form display, ensure that the field is shown as {{<field>}} in which case the error will also be automatically displayed. If you are displaying only the value, you might not realize what the error is.

I have a hunch that your field definition shows a field with 'required=True' but the field is not displayed. Or marked as 'disabled' or 'readonly'.
Reply all
Reply to author
Forward
0 new messages