Re: Accessing values in formset loops
On Tuesday, March 29, 2011 12:50:09 pm Nick wrote: > I guess the bigger question is, can I access the values of the fields > without spitting out a form field? > form.field.value? After the form is bound, when you access the field, it's turned into a bound field[1] . This wrapper adds a few extra attributes for rendering the field as html [1] http://docs.djangoproject.com/en/1.3/ref/forms/api/#more-granular-output Mike -- Q: What's the difference between USL and the Titanic? A: The Titanic had a band. -- 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, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Accessing values in formset loops
I guess the bigger question is, can I access the values of the fields without spitting out a form field? On Mar 29, 2:45 pm, Nickwrote: > I am looping through a formset and attempting to add an additional > field to the form that is a multi select checkbox that has a value of > the ID of the current iteration of the formset loop. > > So: > > model1: > name = CharField > ID = IntegerField > FK = ForeignKey('model2') > > model2: > name > > my formset is set up to present all objects related to model2. I would > like to add a field in the form that is a checkbox that passes the ID > of model1 on POST. > > Any clue how this can be accomplished? -- 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, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.