#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: <https://code.djangoproject.com/ticket/28712#comment:7>
Django <https://code.djangoproject.com/>
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 [email protected].
To post to this group, send email to [email protected].
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.

Reply via email to