Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2018-03-08 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  closed
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  ChoiceWidget | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Stephen Swatman):

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


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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2018-02-09 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * needs_better_patch:  0 => 1


Comment:

 I've left a review on the patch.

 My main concern is the documentation: we need to properly document
 `ChoiceWidget` so that this new feature would make sense.

 Beyond that (also on the PR) I think we should be advocating the subclass
 and override `create_option` approach. I know people always want an extra
 keyword arg, but such an approach is both lightweight and maintainable
 (both for Django and user code).

 That approach is under-documented currently. I would advocate closing this
 as `wontfix` and creating a new ticket to properly document
 `ChoiceWidget`.

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-11-02 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Bjorn Kristinsson):

 I ran into a case the other day where this would have been extremely
 useful. I needed to show a select with all options visible, but depending
 on the user's permissions some of the options needed to be disabled. This
 can be achieved by setting the disabled attribute, but since there was no
 way to do that per option, I had to roll my own.

 Looks like this would solve that, and if you're still looking for an
 example to use in the docs, maybe you could show how to disable options?

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-29 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Stephen Swatman):

 * needs_better_patch:  1 => 0


Comment:

 Replying to [comment:10 Tim Martin]:
 > I added a couple of minor comments on the documentation in the pull
 request.

 Thank you! I have amended the mistakes you pointed out.

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-29 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Martin):

 * cc: Tim Martin (added)
 * needs_better_patch:  0 => 1


Comment:

 I added a couple of minor comments on the documentation in the pull
 request.

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-27 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Stephen Swatman):

 * needs_better_patch:  1 => 0


Comment:

 I have made an attempt to address your concerns: a more compelling example
 is given and I have placed it in a more sensible section to cover the
 entire `ChoiceWidget` family.

 Jenkins is indicating non-passing tests but logs and the fact that only
 minor documentation changes have been made and that that the docs test
 still passes lead me to believe this is not an issue with the pull
 request.

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-25 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * needs_better_patch:  0 => 1
 * stage:  Unreviewed => Accepted


Comment:

 I think the functionality could be useful but it would be nice to document
 a more useful use case. Also, the patch documents the new functionality as
 `Select.opt_attrs` but the implementation is on `ChoiceWidget`. Other
 classes such as `RadioSelect` inherit from `ChoiceWidget`, not from
 `Select`.

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-25 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Stephen Swatman):

 Replying to [comment:6 Tim Graham]:
 > I still don't find the example in the documentation particularly
 compelling. Instead of adding CSS classes for that case, I would use CSS
 [value=x] selectors.
 The particular case that inspired me to create this issue is that I had a
 model and I wanted to create a choice widget for that model. I wanted each
 option to be styled such that it had a background image served from a
 different server such that I needed to construct an attribute of the form
 `style="background-image: url(https://somewhere.com/images/[id].png)"`
 where the ID was the model's ID. The problem was solved by extending the
 `Select` class and overriding the `create_option()` method. However, I
 feel it would have been more easily solved had the pull request I created
 been in place.

 Still, I absolutely understand if you think this is too niche. Thus, if I
 haven't convinced you please feel free to close the issue!

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-25 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham):

 I still don't find the example in the documentation particularly
 compelling. Instead of adding CSS classes for that case, I would use CSS
 [value=x] selectors.

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-18 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Stephen Swatman):

 Replying to [comment:4 Tim Graham]:
 > As for the case of styling, wouldn't it involve less markup to set a
 class on the `` and use a CSS selector (e.g. `select.super option
 {...}`) for that? If anything, I'd think we'd want a way to specify a
 different attribute value for each `` value -- setting the same
 key/value on every `` doesn't seem like something to encourage.

 You're right that the implementation in the PR was not very powerful. I
 have now expanded the PR to allow for callable attribute values. This
 would allow developers a lot of control over the attributes of each
 option.

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-18 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham):

 As for the case of styling, wouldn't it involve less markup to set a class
 on the `` and use a CSS selector (e.g. `select.super option
 {...}`) for that? If anything, I'd think we'd want a way to specify a
 different attribute value for each `` value -- setting the same
 key/value on every `` doesn't seem like something to encourage.

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-18 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+-
 Reporter:  Stephen Swatman  |Owner:  Stephen
 |  Swatman
 Type:  New feature  |   Status:  assigned
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Stephen Swatman):

 * owner:  nobody => Stephen Swatman
 * status:  new => assigned
 * has_patch:  0 => 1


Comment:

 Proposed PR: https://github.com/django/django/pull/9260

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


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-18 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+--
 Reporter:  Stephen Swatman  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--

Comment (by Stephen Swatman):

 Replying to [comment:1 Tim Graham]:
 > Could you describe your use case in more detail? Is there a reason that
 overriding `ChoiceWidget.create_option()` wouldn't work?

 Web developers may want to individually style each option in a
 `ChoiceWidget`, be it by adding CSS classes or style attributes. This may
 be done to add images to such a widget to make it more appealing to the
 user. Developers may also want to add ARIA properties to the options or
 add additional information to work with them via JavaScript.

 It would absolutely be possible to override the `ChoiceWidget` class and
 modifying the `create_option()` method. I imagine, however, that this is a
 common enough use case to warrant a simpler method of doing this. Here are
 some people on StackOverflow having the same issue:

 * https://stackoverflow.com/questions/6477856/how-to-add-attributes-to-
 option-tags-in-django
 * https://stackoverflow.com/questions/43524214/django-add-attributes-to-
 selectmultiple-option-tags
 * https://stackoverflow.com/questions/5089396/django-form-field-choices-
 adding-an-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/069.61641e80d297b7c0e9ca9e1c59e7bda4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-17 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
-+--
 Reporter:  Stephen Swatman  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  ChoiceWidget | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by Tim Graham):

 * easy:  1 => 0


Comment:

 Could you describe your use case in more detail? Is there a reason that
 overriding `ChoiceWidget.create_option()` wouldn't work?

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


[Django] #28712: Add ability to apply separate attributes to ChoiceWidget options

2017-10-14 Thread Django
#28712: Add ability to apply separate attributes to ChoiceWidget options
---+--
   Reporter:  Stephen Swatman  |  Owner:  nobody
   Type:  New feature  | Status:  new
  Component:  Forms|Version:  master
   Severity:  Normal   |   Keywords:  ChoiceWidget
   Triage Stage:  Unreviewed   |  Has patch:  0
Needs documentation:  0|Needs tests:  0
Patch needs improvement:  0|  Easy pickings:  1
  UI/UX:  0|
---+--
 For `ChoiceWidget` objects the list of options is created in the
 `create_option` method. Currently, options created by this method can
 either inherit attributes from the parent widget or have no attributes at
 all but there is no way to separately assign attributes to options as far
 as I am aware. I would like to suggest introducing the ability to specify
 separate option attributes in the `ChoiceWidget` constructor which are
 applied only to the options in that widget.

 Even more powerful would be the ability to pass callables as attribute
 values which could dynamically compute attributes based on option
 attributes such as names and values.

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