Reputation: 143
Subjects says it all pretty much. I want the user to be able to choose the background of their profile. I want them to be able to choose from a few generic colors in a combo box or type in their own hex code in a box below. So my question is... can I set each option in a combo box to a color instead of a word? Thanks!
COLOR_CHOICES = (
(u'Red', *a rectangle of red*),
(u'Orange', *a rectangle of orange*),
(u'Yellow', *a rectangle of yello*),
(u'Green', *a rectangle of green*),
(u'Blue', *a rectangle of blue*),
(u'Purple', *a rectangle of purple*),
)
bgcolor = models.CharField(max_length=16, choices=COLOR_CHOICES)
Upvotes: 0
Views: 340
Reputation: 799210
Create a custom widget that displays colors based on the value for the entry, then assign the widget in the form.
Upvotes: 1