Very bad experience in Django...

37 views
Skip to first unread message

steveneo

unread,
Jun 25, 2009, 8:24:43 AM6/25/09
to Django users
I try to use Django in a new project. Honestly, it is very bad
experience. It looks not boosting my development speed. Today, I
almost give up and begin to look up another Python framework....

One question, does anyone use a hiddenInput in Form? Something like:
class ProfileForm(forms.Form):
cpwd = forms.BooleanField(widget=forms.HiddenInput, initial=False)


Whatever I use {{form.as_p}} or customized form. It always reports
"(Hidden field cpwd) This field is required." I check out the HTML
source, the hidden field is just there:
<input type="hidden" name="cpwd" value="False" id="id_cpwd" />

I try to use CharField() instead, it looks all right but I don't want
to do such hack...

I really feel a little crazy to trace the reason.... It looks a very
simple usage but so buggy... I am a little suspect whether there are
more bugs ahead of my development process.

Joshua Partogi

unread,
Jun 25, 2009, 8:39:05 AM6/25/09
to django...@googlegroups.com

Daniel Roseman

unread,
Jun 25, 2009, 8:51:14 AM6/25/09
to Django users
So, coming entirely new to a framework, you have a single problem, and
this makes it a 'very bad experience'? Maybe you should get a sense of
proportion.

In the meantime, the documentation on BooleanField is quite clear:
"Validates that the check box is checked (i.e. the value is True) if
the field has required=True."
And the box underneath explains further:
"Since all Field subclasses have required=True by default, the
validation condition here is important. If you want to include a
checkbox in your form that can be either checked or unchecked, you
must remember to pass in required=False when creating the
BooleanField."

So, since you want the value to be False, you need to pass in
required=False in your declaration.
--
DR.

Chris Withers

unread,
Jun 25, 2009, 9:22:16 AM6/25/09
to django...@googlegroups.com
steveneo wrote:
> I try to use Django in a new project. Honestly, it is very bad
> experience. It looks not boosting my development speed. Today, I
> almost give up and begin to look up another Python framework....

Go for it :-)

Chris

--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk

steveneo

unread,
Jun 25, 2009, 9:43:22 AM6/25/09
to Django users
BooleanField limits only to CheckBox? But I set
widget=HiddenField.... It does not report error. HTML renders
correctly, but actually, you can not use like that?!

Chris Withers

unread,
Jun 25, 2009, 9:46:04 AM6/25/09
to django...@googlegroups.com
steveneo wrote:
> BooleanField limits only to CheckBox? But I set
> widget=HiddenField.... It does not report error. HTML renders
> correctly, but actually, you can not use like that?!

Didn't you hear me: I said go find another framework, Django obviously
sucks because one new user can't get his head around it ;-)

Xavier Ordoquy

unread,
Jun 25, 2009, 9:53:24 AM6/25/09
to django...@googlegroups.com
On Thu, 2009-06-25 at 06:43 -0700, steveneo wrote:
> BooleanField limits only to CheckBox? But I set
> widget=HiddenField.... It does not report error. HTML renders
> correctly, but actually, you can not use like that?!

http://docs.djangoproject.com/en/dev/ref/forms/fields/#booleanfield

You should have read that section, esp:

"Validates that the check box is checked (i.e. the value is True) if the
field has required=True."

and the note following:

"Since all Field subclasses have required=True by default, the
validation condition here is important. If you want to include a
checkbox in your form that can be either checked or unchecked, you must
remember to pass in required=False when creating the BooleanField"

By saying you have a very bad experience with Django because you didn't
read the documentation there's not much we can do for you.


Richard Shebora

unread,
Jun 25, 2009, 10:07:53 AM6/25/09
to django...@googlegroups.com
Chris,

I don't know you.  But I hope your day gets a little better and your problems lighter.

Sincerely,
Richard
--

Thanks,
Richard Shebora

----------------------------------------------------------------------------------------
Information in this transmission is privileged and confidential.
It is intended for the use of the individual or entity named above.
Any review, dissemination, disclosure, alteration,  printing,
circulation or transmission of this email or it's attachments
is prohibited and unlawful.
----------------------------------------------------------------------------------------

Karen Tracey

unread,
Jun 25, 2009, 10:14:30 AM6/25/09
to django...@googlegroups.com
On Thu, Jun 25, 2009 at 9:46 AM, Chris Withers <ch...@simplistix.co.uk> wrote:

steveneo wrote:
> BooleanField limits only to CheckBox?  But I set
> widget=HiddenField.... It does not report error. HTML renders
> correctly, but actually, you can not use like that?!

Didn't you hear me: I said go find another framework, Django obviously
sucks because one new user can't get his head around it ;-)

Please don't be rude. Perhaps your emoticon at the end was intended to convey a light comical tone but tone is extremely hard to convey in email and telling someone to go away because they've expressed some frustration strikes me as rude.  Everyone is free to simply not respond to anyone they feel is expressing unreasonable frustration; I don't see that it helps matters much to try to tell them they are being unreasonable.

To the original poster, if you read the documentation on django.forms.BooleanField:

http://docs.djangoproject.com/en/dev/ref/forms/fields/#booleanfield

you'll see it doesn't say anything about the validation behavior being dependent on the widget in use.  So it doesn't matter what widget you use, if you want to be able to validate False as a valid value, then you need to include required=False in the form field definition.

(There was a huge long contentious discussion about required=True implying a BooleanField value must be True in order for the field to pass validation -- you could find in the ticket tracker if you looked for it.  Not everyone agrees with the choice made, but it was clearly an issue where not everyone was going to agree no matter what decision was made.  It's been made and won't be changed and the way to make your case work is simply pass required=False on the form field definition.)

Karen

Jon Raphaelson

unread,
Jun 25, 2009, 11:58:55 AM6/25/09
to Django users

> you'll see it doesn't say anything about the validation behavior being
> dependent on the widget in use.  So it doesn't matter what widget you use,
> if you want to be able to validate False as a valid value, then you need to
> include required=False in the form field definition.

To be completely fair, the documentation says specifically:

> Validates that the check box is *checked* (i.e. the value is True) if the field has required=True.

and

> If you want to include a *checkbox* in your form that can be either *checked or unchecked*, you must remember to pass in required=False when creating the BooleanField.

I can definitely understand how someone new to the framework, trying
to use a custom widget to do HiddenFields (which is more arcane that
it should be IMO, but that's off topic) and reading the BooleanField
docs could get confused about using them _without a checkbox widget_.
I'm going to open a ticket against the doc here and submit a first
pass at a documentation patch. Confusion is worth fixing IMO.

- Jon

Lars Stavholm

unread,
Jun 26, 2009, 2:47:50 AM6/26/09
to django...@googlegroups.com
Chris Withers wrote:
> steveneo wrote:
>> I try to use Django in a new project. Honestly, it is very bad
>> experience. It looks not boosting my development speed. Today, I
>> almost give up and begin to look up another Python framework....
>
> Go for it :-)

+1
/L

iyank7

unread,
Jun 26, 2009, 4:55:21 AM6/26/09
to django...@googlegroups.com
Joshua Partogi wrote:
>
> You need to define required=False
>
> On Thu, Jun 25, 2009 at 10:24 PM, steveneo <stev...@gmail.com
> <mailto:stev...@gmail.com>> wrote:


if steveneo got `Very Bad experience`, maybe i got `Very..very... n
very... bad experience`,

but i still learning django ^_^

*There`s no magic, its must be explicitly defined ^_^

iyank4

Reply all
Reply to author
Forward
0 new messages