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'
> It sounds like you're looking for a modelform.
I don't think I need modelform 'cause my purpose it's only show books
items details with a checkbox for each one.
I need to obtain html like this:
Book title: "Harry Potter and the
Philosopher's Stone" price: "25.00"
Book title: "
It sounds like you're looking for a modelform.
--~--~-~--~~~---~--~~
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, s
> Try using a multiplemodelchoice field with a checkboxselectmultiple widget.
>
> Alex
Ok thanks, I've changed forms.py like this:
-- forms.py --
class BookForm(forms.Form):
book_item = forms.ModelMultipleChoiceField
(queryset=Book.objects.all(),
widget=forms.CheckboxSelectMultiple)
On 2/27/09, MarcoS wrote:
>
> Hi! wondering if someone could point me in the right
> direction with this one:
>
> I'm trying to populate fields in a form with data from database:
> i.e. suppose I've this model:
>
Try using a multiplemodelchoice field with a checkboxselectmultiple widget.
Alex
>
Hi! wondering if someone could point me in the right
direction with this one:
I'm trying to populate fields in a form with data from database:
i.e. suppose I've this model:
-- models.py --
class Book(models.Model):
title = models.CharField(max_length=100)
pages = models.IntegerField()
6 matches
Mail list logo