Hi All,

I have a simple model Node defined as such:

class Node(models.Model):
    name = models.CharField(max_length=255, unique=True)
    description = models.CharField(max_length=255)
    active = models.BooleanField(default=True)

Now I want to create a formset of this form:

class NodeSelectionForm(forms.Form):
    node = forms.ModelChoiceField(Node.objects.none())
    doStage1= forms.BooleanField()
    doStage2 = forms.BooleanField()
    doStage3 = forms.BooleanField()

I would like the generated code to be something similar to this for
each form instance:

<input type="checkbox" name="node" value="{{node.pk}}"> Use this node
<input type="checkbox" name="doStage1"> Do stage 1
<input type="checkbox" name="doStage2"> Do stage 2
<input type="checkbox" name="doStage3"> Do stage 3

My questions are
1) How can I create multiple forms that each point to a single
instance of a Node.  I assume something like form.fields
['node'].queryset = Node.objects.get(...) from within the view
2) Instead of having a choice I just want node to be a togglable
checkbox as shown above where the name or value has a reference to the
node's primary key so I know which node we're talking about. How can I
do this?
3) Is forms the right thing to use here?

Right now I'm resorting to doing this without forms, as I can't seem
to find enough documentation to satisfy my particular situation above.

Thanks for reading.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to