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 %} ... 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django Models: How to allow users to select an image from a choice of 3 pictures
На Sun, 15 Jul 2012 18:26:02 -0700 (PDT) crobertsнаписа: > I am familiar with the use of Field.choices for text. > > However, I'd like the same option for images. Is this possible? I > want users to select one image from a list of 3 and be able to save > this. They can later come back in and change it if they wish. I > know that in order to save this, it must be in Models. > > The idea: > > Each day, the has the option of selecting an image: happy face, sad > face, smiley face of how they are feeling. Their selection is > saved. They can go in later to change it if they wish. > > ImageField doesn't seem to do this. It seems to only allow for > uploaded images as opposed to a choice. > Use Choice field with image in the option. You do not need FIleField, couse you don't operate with files at all. You just want to put an image in a select. There are several ways to achieve this: background image (pure html+css) http://binnyva.blogspot.com/2006/01/icons-for-select-menu-options-in.html Jquery UI; or something like this: http://www.marghoobsuleman.com/jquery-image-dropdown -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django Models: How to allow users to select an image from a choice of 3 pictures
I am familiar with the use of Field.choices for text. However, I'd like the same option for images. Is this possible? I want users to select one image from a list of 3 and be able to save this. They can later come back in and change it if they wish. I know that in order to save this, it must be in Models. The idea: Each day, the has the option of selecting an image: happy face, sad face, smiley face of how they are feeling. Their selection is saved. They can go in later to change it if they wish. ImageField doesn't seem to do this. It seems to only allow for uploaded images as opposed to a choice. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Cr7s4l8i_bcJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.