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'<select name="album" id="id_album">']
self <django.newforms.widgets.Select object at 0xbb7b766c>
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 [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
-~----------~----~----~----~------~----~------~--~---