MrLoick / app-engine-patch

Automatically exported from code.google.com/p/app-engine-patch
0 stars 0 forks source link

form-field and for loop is not working with FormWithSetsInstance #173

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a form with FormSets
2. Use it via generic_views.create_object
3. Try to iterate form or formset in a for loop under django template

What is the expected output? What do you see instead?
a. form.form-field have to accessible with django form and formset to
generate custom views
b. form and formset have to be iteratable
instead when using FormWithSets form.form-field is not working and when for
loop is used with form an exception is thrown as FormWithSetsInstance is
not iteratable

What version of the product are you using? On what operating system?
latest app-engine-patch, Win XP

Please provide any additional information below.

Original issue reported on code.google.com by dgkmur...@gmail.com on 25 Jun 2009 at 9:53

GoogleCodeExporter commented 8 years ago
what does your template look like, you should be able to iterate through 
form.formsets 
and access item.formset.

Original comment by norm...@gmail.com on 29 Jun 2009 at 11:43

GoogleCodeExporter commented 8 years ago
I am not using the standard Django FormSets, instead I am using 
ragendja.forms.FormWithSets 

When using ragendja.forms form.form-field and form.formset are not working.

Example:

1. {{ form.form-field }}

2. {% for form in form.formset %}

Later when I looked at the ragendja.forms code I did notice that it is missing 
the 
definition for __getitem__.  Now I have fixed this in my local ragendja.forms 
and it 
is working.

Thanks

Original comment by dgkmur...@gmail.com on 29 Jun 2009 at 4:34

GoogleCodeExporter commented 8 years ago
Right, the ragendja formwithsets is designed so that it can be used without the 
pesky 
requirement to manually supply a template, i.e. just use {{ form }}

A FormWithSet is a wrapper for a Form, that knows how to render FormSetFields 
as 
FormSets correctly without having to muck about and specify it in the template 
manually.

If you really need to iterate through a FormSet in a FormSetField, then you can 
loop 
{% for boundform in form.formsets %} and use {{ boundform.formset }} to access 
each 
formset

Hope that helps.

Original comment by norm...@gmail.com on 29 Jun 2009 at 7:29

GoogleCodeExporter commented 8 years ago
So, I guess this can be closed, then?

Original comment by wkornew...@gmail.com on 3 Jul 2009 at 9:34

GoogleCodeExporter commented 8 years ago
Thanks, the call can be closed.

Original comment by dgkmur...@gmail.com on 3 Jul 2009 at 9:37

GoogleCodeExporter commented 8 years ago
I can iterate in the formsetfield
but how do I use {{ form.form-field }} ?
and how do I access form field in  {{ boundform.formset }}?
will it be easier if i use django form factory?
Thanks!

Original comment by louyuh...@gmail.com on 23 Aug 2009 at 4:33