I solved it!
I was getting drowning in my own spittle!
This is the code in forms.py
class BookForm(forms.Form):
def __init__(self, *args, **kwargs):
super(BookForm, self).__init__(*args, **kwargs)
books = Book.objects.all()
for item in books:
field = '%s' % item.pk
self.fields[field] = forms.BooleanField(label='Title: %s -
price: %d' % (item.title, item.price))
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---