On Sep 2, 2:54 pm, Bill Freeman <ke1g...@gmail.com> wrote:
> Let's start by agreeing on common terminology.  "property" has
>  a meaning in Python slightly different than its usage in some
> other languages, and I don't think that's what you mean.
>
> I'm thinking that what you mean by "property" on the form is what
> Python calls an attribute of the instance of the form class.  

Yeah, sorry about the term. Attribute is what I mean.

[some paragraphs elided for now...]

> And you want to include, somewhere between the statements above:
>
>    form.product_description = u'Some string involving "hanging weight"'
>
> Am I tracking so far?

Yeah, except I can do that easily for a normal form.  Am trying to
figure out how to do it for forms in a formset.  I can add the same
attribute with the same value to all forms in a formset by doing
something like:

for form in formset.forms:
    form.project_description = "Beef etc."

But of course each product has a different description.

> If so, in your template, you should, at the appropriate point, be able to
> say:
>
>   <TD>{{ beef_form.product_description }}</TD>
>
> That should do what you would think.  The product_description attribute is
> not used automatically by anything, but is available for the variable 
> reference
> in the template.
>
> So, is this what you want, and if so have you tried it, and if so what don't
> you like about the result?

Works great and is less filling for regular forms, and I do it all the
time.  Including in my set-of-forms which is not a formset, which is
how I did it before formsets were invented.  I want to do the same
thing for forms in a formset.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to