Re: Two newform best practice questions

2007-09-26 Thread Mark Green
On Wed, 2007-09-26 at 23:56 -0500, Joseph Kocherhans wrote: > On 9/26/07, Mark Green <[EMAIL PROTECTED]> wrote: > > > > I say thanks for the pointer, too. > > A quick question (since you seem to be involved with this), is there any > > reason to have django not prefix the form fields by default wi

Re: Two newform best practice questions

2007-09-26 Thread Joseph Kocherhans
On 9/26/07, Mark Green <[EMAIL PROTECTED]> wrote: > > I say thanks for the pointer, too. > A quick question (since you seem to be involved with this), is there any > reason to have django not prefix the form fields by default with, say, > the model-name (so prefix='' or prefix='somethingelse' can

Re: Two newform best practice questions

2007-09-26 Thread Mark Green
Hi Joseph, I say thanks for the pointer, too. A quick question (since you seem to be involved with this), is there any reason to have django not prefix the form fields by default with, say, the model-name (so prefix='' or prefix='somethingelse' can still be used if someone doesn't want it that wa

Re: Two newform best practice questions

2007-09-25 Thread Przemek Gawronski
> Try this: >f1 = Form1(request.POST, prefix='form1') >f2 = Form2(request.POST, prefix='form2') > That should solve your problem. The prefix argument is prepended to > every field name in the html, thus preventing name clashes between > forms. That should be in the 0.96 release. No docs

Re: Two newform best practice questions

2007-09-25 Thread Joseph Kocherhans
On 9/26/07, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > > I'm using several forms (newforms) to build one html form. One thing to > watch out for is common field names in your django form classes. So if > you have two django forms and they both have a field 'date' for example, > then handling i

Re: Two newform best practice questions

2007-09-25 Thread Przemek Gawronski
> Use form_for_model or form_for_instance using the fields argument. Make > one form object for each model with the field subset you'd like to use. > There's nothing stopping you from using several form objects in the same > html form. Just remember to validate them all. I'm using several forms (

Re: Two newform best practice questions

2007-09-25 Thread John M
I use the form_for_instance(instance, form=) and this works great for me, however I found a bug (which is documented), that doesn't actually populate the data, so if you're not getting the POST data, and you just want to display the current instance, you'll need to do a theform = form(instance.__

Re: Two newform best practice questions

2007-09-25 Thread Cat
Thanks Chris I will try your suggestions and see how I go. On Sep 25, 7:04 pm, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > 1) What is best practice to populate a custom form with instance data? > > Use form = Form(data_dict) and you're done. This also triggers > validation, so it might not be

Re: Two newform best practice questions

2007-09-25 Thread Chris Hoeppner
> 1) What is best practice to populate a custom form with instance data? Use form = Form(data_dict) and you're done. This also triggers validation, so it might not be exactly what you want. Though, it's the only way I know of. > 2) What is the recommended way to create a single custom form that >

Two newform best practice questions

2007-09-24 Thread Cat
Hello I'm starting out with newforms and although I have found a lot of examples using form_for_instance I haven't found enough on custom forms to answer (at least for me) the following questions: 1) What is best practice to populate a custom form with instance data? 2) What is the recommended