Re: [Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-02 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+--
 Reporter:  jdufresne  |Owner:  nobody
 Type:  Uncategorized  |   Status:  closed
Component:  Forms  |  Version:  master
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Unreviewed
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by claudep):

 This might be a topic for a django-developers discussion, to see if you
 can get some traction for your suggestion.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.8b5a0a8f085245d43bdeca30b8a6088d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-02 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+--
 Reporter:  jdufresne  |Owner:  nobody
 Type:  Uncategorized  |   Status:  closed
Component:  Forms  |  Version:  master
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Unreviewed
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by jdufresne):

 > think that your use case is fulfilled by something like:
 >
 > `forms.ChoiceField(widget=forms.RadioSelect, choices=((1, 'Yes'), (0,
 'No')), required=True)`

 One of the issues with this, it evaluates to the string `'1'` and `'0'`
 (or `'True'` and `'False'`) and not the values: `True`, `False`, `None` as
 the `NullBooleanField` does. I think that is the major downside here.

 So in the end, a custom field and widget is required by the application
 writer for something that seems very simple on the surface. That is, a
 boolean form field that does not default to `False` and must be answered
 either `True`/`False`.

 Obviously one can always add this into their own project -- and maybe my
 proposal is the incorrect approach -- but I still think it would be nice
 to have something to accomplish this built-in.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.54ebc54b40d143315e5263e876659a1f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-02 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+--
 Reporter:  jdufresne  |Owner:  nobody
 Type:  Uncategorized  |   Status:  closed
Component:  Forms  |  Version:  master
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Unreviewed
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by claudep):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 I don't think excluding the validity of the `Unknown` choice when
 `required=True` is a good idea at all.
 I think that your use case is fulfilled by something like:
 {{{
  forms.ChoiceField(widget=forms.RadioSelect, choices=((1, 'Yes'), (0,
 'No')), required=True)
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.112aa09941e0e7e7490c34eff2c694ae%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-02 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+--
 Reporter:  jdufresne  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Forms  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by jdufresne):

 > The fix for #23130 may address the use case of this ticket.

 If I understand that ticket correctly (and perhaps I don't) that looks to
 be dealing with the model layer and how it creates forms in the admin
 site. Is this correct?

 My use case has no connection to models nor the admin site. This is just a
 straight form POST to a view with validating and processing that data.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.f771fc4e4738930d1bba5158d7799a41%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-02 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+--
 Reporter:  jdufresne  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Forms  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by jdufresne):

 > What would then be the difference between your proposal
 (forms.fields.NullBooleanField with required=True) and
 forms.fields.BooleanField with required=False?

 `forms.fields.BooleanField` does not allow for a "no answer". In my
 application the user must *explicitly* select Yes or No. Assuming No when
 no answer is provided is not an option.

 Just for some clarification, I'm rendering this field as a yes/no radio
 option:

 {{{
 This field is required.
 Do you agree with foo?
 [ ] Yes
 [ ] No
 }}}

 With my proposal above, the user would need to explicitly select No for
 the field to evaluate as `False`, if the field is required and and they do
 not select No, they will be warned.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.df8afcc2339ee9f7b109406ad171853c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-02 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+--
 Reporter:  jdufresne  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Forms  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by timgraham):

 I think the primary difference is the widget used. In the case of
 `NullBooleanField`, you get a `` where the user must pick `True`
 or `False`, whereas `BooleanField` is a checkbox where no explicit
 selection must be made.

 The fix for #23130 may address the use case of this ticket.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.d06145f2ef0afda6ad8c43d87016fd8f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-01 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+--
 Reporter:  jdufresne  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Forms  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by claudep):

 What would then be the difference between your proposal
 (`forms.fields.NullBooleanField` with `required=True`) and
 `forms.fields.BooleanField` with `required=False`?

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.a62af5908f381baef761f43f089f77fd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-01 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+--
 Reporter:  jdufresne  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Forms  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by jdufresne):

 * cc: jon.dufresne@… (added)
 * needs_better_patch:   => 0
 * has_patch:  0 => 1
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Submitted pull required: 

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.41bb7d44d732e30097877ac2e214c5b3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #23580: forms.fields.NullBooleanField does not honor required=True

2014-10-01 Thread Django
#23580: forms.fields.NullBooleanField does not honor required=True
---+
 Reporter:  jdufresne  |  Owner:  nobody
 Type:  Uncategorized  | Status:  new
Component:  Forms  |Version:  master
 Severity:  Normal |   Keywords:
 Triage Stage:  Unreviewed |  Has patch:  0
Easy pickings:  0  |  UI/UX:  0
---+
 I use `forms.fields.NullBooleanField` to allow a user to select Yes, No or
 Unknown (Unknown may also mean "no answer"). Sometimes -- depending on the
 site configuration -- this field should be required, other times not. In
 this case, required means that either Yes or No should be selected. The
 field should *not* be left blank (Unknown or "no answer"). Currently, when
 `required=True` is set, `forms.fields.NullBooleanField.validate()` does
 nothing and will simply validate all values.

 I can't use `forms.fields.BooleanField` because when `required=True` is
 set Yes *must* be selected for the field to validate.

 This topic has come up in the past: 

 I propose `forms.fields.NullBooleanField` be altered to handle required.
 That is change validate to:

 {{{
 def validate(self, value):
 if value is None and self.required:
 raise ValidationError(
 }}}

 I'll happily create a pull request to achieve this. One concern will be
 backwards compatibility. But seeing as how `required=True` had no effect
 on the field originally, I see no reason anyone would set it and expect
 something useful other than what has been suggested above.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.1e13a061a936cca868708095139c46c7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.