Re: Django Models: How to allow users to select an image from a choice of 3 pictures
On 16-7-2012 3:26, croberts wrote:
> I am familiar with the use of Field.choices for text.
Then that's all you need. Let the template handle the image rendered:
EMO_CHOICES = (
('smiley_sad.png', 'sad sad emo'),
('smiley_neutral.png', 'ask me later'),
('smiley_happy.png', 'happy happy joy joy'),
)
in template:
{% load static %}
...
<img src="{% static "images/" %}{{model.field.choicefield}}" .../>
And of course you can dress it up as Ivan showed, but the basic
principles are the same.
--
Melvyn Sopacua
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home