Re: TypeError on forms.ChoiceField
On Wed, 30 Jan 2008 10:30:04 +0200, Eren T�rkay wrote: > On 30 Jan 2008 Wed 05:49:28 Patrick J. Anderson wrote: >> How can I inject a subset of related photoalbums into this form? > > I don't know much about iteration of models, but in traditional ways, > you can create "choices" tuple from "PhotoAlbum" instance. > > I was trying to do that using choices = PhotoAlbum.objects.all() --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: TypeError on forms.ChoiceField
On 30 Jan 2008 Wed 05:49:28 Patrick J. Anderson wrote: > How can I inject a subset of related photoalbums into this form? I don't know much about iteration of models, but in traditional ways, you can create "choices" tuple from "PhotoAlbum" instance. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
TypeError on forms.ChoiceField
I'm using newforms and ModelForm and I'm getting a TypeError on the following code: class PhotographForm(forms.ModelForm): album = forms.ChoiceField(choices = PhotoAlbum.objects.all()) class Meta: model = Photograph The error message states: "'PhotoAlbum' object is not iterable" I had previously thought and Django documentation states that a Queryset was an iterable. The debugging information shows this: attrs {'id': u'id_album'} choices () final_attrs {'id': u'id_album', 'name': 'album'} name 'album' output [u''] self str_value u'1' value 1 How can I inject a subset of related photoalbums into this form? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---