Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread bobhaugen
I am so dense sometimes... I had forgotten that initial data in a formset is a *list* of dictionaries. So I set up the initial data in a loop over the available products, and created a parallel list of product_descriptions in the same loop. Then set up the formset, and looped over formset.forms

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread bobhaugen
Bill, thanks a ton for the conversation. I will try some variations of that set of ideas over the weekend and report back here with what works. And you are correct, I am not now creating the formset forms in a loop, but might try that as one variation. -Bob -- You received this message becaus

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread Bill Freeman
Well, if you can iterate the forms of a formset in the template, you can do it in python. I guess the trick is whether there is a public interface for accessing the model instance of the current form during such an iteration, (I'm assuming here that the fields you do want to use a fields comes fr

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread bobhaugen
On Sep 2, 2:54 pm, Bill Freeman 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

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread Bill Freeman
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

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread bobhaugen
Bill, Thanks a lot for sticking with this question. On Sep 2, 1:44 pm, Bill Freeman wrote: > I guess that what I'm saying is that when you get fussy about rendering, you > need to write the html/css yourself.  Because you say you want read only for > these fields, don't use the form field's rend

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread Bill Freeman
I guess that what I'm saying is that when you get fussy about rendering, you need to write the html/css yourself. Because you say you want read only for these fields, don't use the form field's rendering at all (or use a hidden field). Compose a div or span or whatever suits your fancy, and pass w

Re: how to add a non-field text property to forms in a formset

2010-09-01 Thread bobhaugen
On Sep 1, 12:17 pm, Bill Freeman wrote: > This seems to me to be a job for the template.  The forms documentation has > a section on custom rendering which shows you how to iterate through the > fields, or access them by name.  You would insert whatever HTML construct > was appropriate for your te

Re: how to add a non-field text property to forms in a formset

2010-09-01 Thread Bill Freeman
This seems to me to be a job for the template. The forms documentation has a section on custom rendering which shows you how to iterate through the fields, or access them by name. You would insert whatever HTML construct was appropriate for your text, providing a context variable giving its conte

how to add a non-field text property to forms in a formset

2010-09-01 Thread bobhaugen
I often want to add properties to a formset that will fill a table cell with flexibly wrapping, read-only descriptive text. For example, the description of a product, where the enterable field is the quantity ordered. If I use a field, the widget gets a fixed width and the contents do not wrap (u