Hey just a newbie question about the design of the models.py What is
the best way to use the result of objects.values_list for a choices
model ?
********************** shell *******************
In [1]: from photos.models import Image, Pool
In [3]: Image.objects.values_list('image')
Out[3]: [(u'photologue/photos/wielrenfiets.jpg',), (u'photologue/
photos/example2.jpg',)]
********************** models.py ***************
"""Post model."""
URL_CHOICES = (
(1, _('................ generated from image list (so
wielrenfiets.jpg) ......... ')),
(2, _('................ generated from image list (so
example2.jpg )......... ')),
(3, _('................ generated from image list .........
')),
etc
)
url = models.IntegerField(_('url'), choices=URL_CHOICES,
default=1)
************************
Is this something for a ModelChoiceField or Formset ? This replacement
failed
url = ModelChoiceField(queryset=Image.objects.values_list
('image'))
thanks in advance
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.