Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2020-02-27 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  closed
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
  HTML,Select,wdiget,ModelChoiceField|  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * needs_better_patch:  1 => 0


Comment:

 Follow-up in #31295.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.01409c3ac01053b95be6cbbbf78cac22%40djangoproject.com.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2020-02-27 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  closed
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
  HTML,Select,wdiget,ModelChoiceField|  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Aurélien Pardon):

 * cc: Aurélien Pardon (added)
 * needs_better_patch:  0 => 1


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.5ee44ed72d316e44faef895a8348a7d9%40djangoproject.com.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2020-02-27 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  closed
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
  HTML,Select,wdiget,ModelChoiceField|  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Aurélien Pardon):

 There is a huge performance regression as a side-effect of
 [changeset:"aaecf038cae61f114db396f74e06759c95f21e93" aaecf038]. For
 {{{ModelChoiceField}}} with {{{empty_label=None}}}, it doubles the queries
 to the database.

 With this {{{simple_app/models.py}}}:
 {{{#!python
 from django.db import models

 class MyModel(models.Model):
 my_field = models.CharField(max_length=1)
 }}}

 the following code:
 {{{#!python
 from django import forms
 from simple_app.models import MyModel

 class MyForm(forms.Form):
 my_form_field = forms.ModelChoiceField(MyModel.objects.all(),
 empty_label=None)

 MyForm().as_ul()
 }}}

 makes two times the same request to the database:
 {{{#!python
 >>> from django.db import connection
 >>> from django.db import reset_queries
 >>> reset_queries()
 >>> _ = MyForm().as_ul()
 >>> connection.queries
 [{'sql': 'SELECT "simple_app_mymodel"."id",
 "simple_app_mymodel"."my_field" FROM "simple_app_mymodel"',
   'time': '0.000'},
  {'sql': 'SELECT "simple_app_mymodel"."id",
 "simple_app_mymodel"."my_field" FROM "simple_app_mymodel"',
   'time': '0.000'}]
 }}}

 Before this commit, it only makes one request (as intended IMO):
 {{{#!python
 >>> from django.db import connection
 >>> from django.db import reset_queries
 >>> reset_queries()
 >>> _ = MyForm().as_ul()
 >>> connection.queries
 [{'sql': 'SELECT "simple_app_mymodel"."id",
 "simple_app_mymodel"."my_field" FROM "simple_app_mymodel"',
   'time': '0.000'}]
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.4e08f4ab70684d6fd783d10b66115ace%40djangoproject.com.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-12-28 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  closed
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
  HTML,Select,wdiget,ModelChoiceField|  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"aaecf038cae61f114db396f74e06759c95f21e93" aaecf038]:
 {{{
 #!CommitTicketReference repository=""
 revision="aaecf038cae61f114db396f74e06759c95f21e93"
 Fixed #27370 -- Prevented Select widget from using 'required' with a non-
 empty first value.
 }}}

--
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/068.ce779058f58845240f7b1eb0e9dda6e2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-11-11 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
  HTML,Select,wdiget,ModelChoiceField|  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Josef Rousek):

 I applied those cosmetic changes.

--
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/068.e91377ba4b6ca6a1f629b1f49f145f26%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-11-11 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
  HTML,Select,wdiget,ModelChoiceField|  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * stage:  Accepted => Ready for checkin


Comment:

 Patch LGTM pending some cosmetic comments.

--
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/068.c19be6fed663c6aad680e5391cfc0804%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-11-05 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Josef Rousek):

 Replying to [comment:10 alexpirine]:
 > I reviewed the code:
 >
 > The overall logic and tests seem to be correct, except in case of an
 empty .
 >
 > But I can not make a full judgment about the code, since I lack the
 understanding of some parts of `widgets.py`. For instance I didn't know
 anything about the `renderer` attribute (I still can not find it in
 documentation).

 Thanks for review! I'll fix those issues.

--
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/068.41dc84682aba4fadb9b3d2b331b6e6bf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-11-05 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by alexpirine):

 I reviewed the code:

 The overall logic and tests seem to be correct, except in case of an empty
 .

 But I can not make a full judgment about the code, since I lack the
 understanding of some parts of `widgets.py`. For instance I didn't know
 anything about the `renderer` attribute (I still can not find it in
 documentation).

--
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/068.f228d4ea58d68bd6a8788a68511ab855%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-11-05 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Josef Rousek):

 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/7497 PR]

--
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/068.19269d4879a0c080cecc2385d28a5074%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-11-05 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  Josef
 Type:   |  Rousek
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Josef Rousek):

 * owner:  nobody => Josef Rousek
 * status:  new => assigned


--
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/068.532fdba2be9ffb94e9e614b6092bb830%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-10-25 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Jon Dufresne):

 alexpirine, I believe Claude is referring to
 
[https://github.com/django/django/blob/adc93e85990b644194c679f528225deed9fdaa85/django/forms/widgets.py#L254-L255
 Widget.use_required_attribute], not `Form.use_required_attribute`. For
 reference, this method will be documented
 [https://github.com/django/django/pull/7419 soon].

--
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/068.a7b7f83c99971d34cc2a5ba7bd1f552a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-10-25 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by alexpirine):

 I agree with Claude.

 Also, `use_required_attribute` applies to all fields, which is not desired
 here. We only want to remove the required attribute from the Select
 widget.

--
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/068.63f6634b6e47f57347d502d563e75593%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-10-25 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Claude Paroz):

 If Django has all needed elements to determine the value of
 `use_required_attribute` in such a situation, it should do it
 automatically and not require the user to add it explicitly.

--
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/068.2162790068a5c6a3473fb5f10bba69eb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-10-25 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andrew Nester):

 Agree with Claude Paroz - all we need to do is to set
 {{{use_required_attribute = False}}} in form where such field used.
 Something like this:

 {{{
 class TestForm(forms.Form):
 use_required_attribute = False

 some_field = forms.ModelChoiceField(queryset=SomeModel.objects.all(),
 empty_label=None)
 }}}

 I guess we don't need some additional changes for this, what do you think
 @alexpirine?

--
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/068.b984bc1b6fe6028fc93a62126051a91e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-10-21 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  HTML,Select,wdiget,ModelChoiceField|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Claude Paroz):

 * version:  1.10 => master
 * type:  Bug => Cleanup/optimization
 * stage:  Unreviewed => Accepted


Comment:

 Here's the validator error message:
 `The first child option element of a select element with a required
 attribute, and without a multiple attribute, and without a size attribute
 whose value is greater than 1, must have either an empty value attribute,
 or must have no text content. Consider either adding a placeholder option
 label, or adding a size attribute with a value equal to the number of
 option elements.`
 At first sight, this should be doable without difficulty in the widget's
 `use_required_attribute` method.

--
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/068.fd8989b40854c95353fa4de41743b5a3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-10-20 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
  HTML,Select,wdiget,ModelChoiceField|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by alexpirine:

Old description:

> I didn't think it was wrong in HTML, but the W3C validator says so, and
> after reading this discussion, it seems to be right:
>
> https://github.com/validator/validator/issues/47
>
> This is how I could explain it:
>
> If a form field is required and has the `empty_label=True` argument, the
> generated `` will have a `required="required"` attribute. This
> doesn't make sense since the first item will be selected anyways, and
> there is no way for the user to ''unselect'' a value.
>
> So, the `required="required"` attribute is useless.
>
> Example:
>
> {{{#!python
> class TestForm(forms.Form):
> some_field = forms.ModelChoiceField(queryset=SomeModel.objects.all(),
> empty_label=None)
> }}}
>
> results in:
>
> {{{#!text/html
> 
> Value 1
> Value 2
> Value 3
> 
> 
> }}}
>
> You can check the following code using the
> [https://validator.w3.org/#validate_by_input W3C validation service]:
>

> {{{#!text/html
> 
> 
> 
>   
>   Validation test
> 
> 
>   
> Value 1
> Value 2
> Value 3
> 
>   
> 
> 
> }}}

New description:

 I didn't think it was wrong in HTML, but the W3C validator says so, and
 after reading this discussion, it seems to be right:

 https://github.com/validator/validator/issues/47

 This is how I could explain it:

 If a form field is required and has the `empty_label=True` argument, the
 generated `` will have a `required="required"` attribute. This
 doesn't make sense since the first item will be selected anyways, and
 there is no way for the user to ''unselect'' a value.

 So, the `required="required"` attribute is useless.

 Example:

 {{{#!python
 class TestForm(forms.Form):
 some_field = forms.ModelChoiceField(queryset=SomeModel.objects.all(),
 empty_label=None)
 }}}

 results in:

 {{{#!text/html
 
 Value 1
 Value 2
 Value 3
 
 
 }}}

 You can check the following code using the
 [https://validator.w3.org/#validate_by_input W3C validation service]:


 {{{#!text/html
 
 
 
   
   Validation test
 
 
   
 Value 1
 Value 2
 Value 3
 
   
 
 
 }}}

 In order to fix this, the generated `` widget should not have a
 `required` attribute.

--

--
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/068.d508c1811254949aafcb438cc326c373%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-10-20 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:  alexpirine   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
  HTML,Select,wdiget,ModelChoiceField|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by alexpirine):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old description:

> I didn't think it was wrong in HTML, but the W3C validator says so, and
> after reading this discussions, it seems to be right:
>
> https://github.com/validator/validator/issues/47
>
> This is how I could explain it:
>
> If a form field is required and has the `empty_label=True` argument, the
> generated `` will have a `required="required"` attribute. This
> doesn't make sense since the first item will be selected anyways, and
> there is no way for the user to ''unselect'' a value.
>
> So, the `required="required"` attribute is useless.
>
> Example:
>
> {{{#!python
> class TestForm(forms.Form):
> some_field = forms.ModelChoiceField(queryset=SomeModel.objects.all(),
> empty_label=None)
> }}}
>
> results in:
>
> {{{#!text/html
> 
> Value 1
> Value 2
> Value 3
> 
> 
> }}}
>
> You can check the following code using the
> [https://validator.w3.org/#validate_by_input W3C validation service]:
>

> {{{#!text/html
> 
> 
> 
>   
>   Validation test
> 
> 
>   
> Value 1
> Value 2
> Value 3
> 
>   
> 
> 
> }}}

New description:

 I didn't think it was wrong in HTML, but the W3C validator says so, and
 after reading this discussion, it seems to be right:

 https://github.com/validator/validator/issues/47

 This is how I could explain it:

 If a form field is required and has the `empty_label=True` argument, the
 generated `` will have a `required="required"` attribute. This
 doesn't make sense since the first item will be selected anyways, and
 there is no way for the user to ''unselect'' a value.

 So, the `required="required"` attribute is useless.

 Example:

 {{{#!python
 class TestForm(forms.Form):
 some_field = forms.ModelChoiceField(queryset=SomeModel.objects.all(),
 empty_label=None)
 }}}

 results in:

 {{{#!text/html
 
 Value 1
 Value 2
 Value 3
 
 
 }}}

 You can check the following code using the
 [https://validator.w3.org/#validate_by_input W3C validation service]:


 {{{#!text/html
 
 
 
   
   Validation test
 
 
   
 Value 1
 Value 2
 Value 3
 
   
 
 
 }}}

--

--
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/068.871c2b07031613a05149f1eadc40f451%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27370: Django's Select widget adds a required="required" attribute, even if created with empty_label=True

2016-10-20 Thread Django
#27370: Django's Select widget adds a required="required" attribute, even if
created with empty_label=True
-+-
 Reporter:   |  Owner:  nobody
  alexpirine |
 Type:  Bug  | Status:  new
Component:  Forms|Version:  1.10
 Severity:  Normal   |   Keywords:  HTML,Select,wdiget,ModelChoiceField
 Triage Stage:   |  Has patch:  0
  Unreviewed |
Easy pickings:  0|  UI/UX:  0
-+-
 I didn't think it was wrong in HTML, but the W3C validator says so, and
 after reading this discussions, it seems to be right:

 https://github.com/validator/validator/issues/47

 This is how I could explain it:

 If a form field is required and has the `empty_label=True` argument, the
 generated `` will have a `required="required"` attribute. This
 doesn't make sense since the first item will be selected anyways, and
 there is no way for the user to ''unselect'' a value.

 So, the `required="required"` attribute is useless.

 Example:

 {{{#!python
 class TestForm(forms.Form):
 some_field = forms.ModelChoiceField(queryset=SomeModel.objects.all(),
 empty_label=None)
 }}}

 results in:

 {{{#!text/html
 
 Value 1
 Value 2
 Value 3
 
 
 }}}

 You can check the following code using the
 [https://validator.w3.org/#validate_by_input W3C validation service]:


 {{{#!text/html
 
 
 
   
   Validation test
 
 
   
 Value 1
 Value 2
 Value 3
 
   
 
 
 }}}

--
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/053.268892837ff52ce7fbf34cb3eb8c742e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.