RE: Using newforms for multiple db rows

2007-05-14 Thread Chris Brand
> I think if it were me I'd build a form builder function, metaclass, or > do it in __init__. Probably the easiest is passing in an argument to > __init__ , that gives enough information to build the form. That sounds like the kind of thing I'm looking for. Thanks very much once again, Chris

Re: Using newforms for multiple db rows

2007-05-11 Thread dballanc
If any two inputs have the same name, both values are returned in a list ala [request.POST.getlist('score')] With the checkboxes it's easy to identify by value. I assume you might be able to figure out where that score belongs by order, but I'm not sure order is guaranteed. I think if it were me

RE: Using newforms for multiple db rows

2007-05-11 Thread Chris Brand
After a few false starts, I managed to get this going. Now my problem is that this approach only really works for Booleans. What if I wanted a form to enter test scores for a class, one score per student ? All my approaches so far have ended up with multiple fields with the same name, which then d

RE: Using newforms for multiple db rows

2007-05-04 Thread Chris Brand
> For the attendance form, you might use a MultipleChoiceField > checkboxSelectMultiple widget, where the value of each choice is set > to the pk of the student model. You should get a list of id's that > were checked when the form gets submitted. Thank you very much. Sounds like that approach

Re: Using newforms for multiple db rows

2007-05-03 Thread dballanc
Don't try too hard to directly link form to model. For the attendance form, you might use a MultipleChoiceField checkboxSelectMultiple widget, where the value of each choice is set to the pk of the student model. You should get a list of id's that were checked when the form gets submitted. Som