straight55b / app-engine-patch

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

FormWithSets gives exception if passing initial values #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a form with FormSetFields
2. Apply the FormWithSets decorator from ragendja.forms 
3. Try to pass initial values into the form

What is the expected output? What do you see instead?

Exception Value:    
__init__() got an unexpected keyword argument 'initial'

What version of the product are you using? On what operating system?
OSX, latest from repo

Please provide any additional information below.

Original issue reported on code.google.com by tommytastic on 24 Apr 2009 at 9:58

GoogleCodeExporter commented 9 years ago
Seems that the FormWithSets is more broken than this - when you submit a form 
with an
empty (but required) field, instead of rendering the field with an error 
message, it
returns the form with the field removed.

Original comment by tommytastic on 24 Apr 2009 at 11:19

GoogleCodeExporter commented 9 years ago
I've fixed the first issue.

The second behavior is expected. The admin interface works the same. When all
required fields are empty the form assumes that the user didn't want to enter 
any
data. Otherwise there would be no way of knowing whether the user actually 
wanted
create such an entity or not.

Original comment by wkornew...@gmail.com on 25 Apr 2009 at 8:58

GoogleCodeExporter commented 9 years ago
The form I have is a bit like this:

class MyForm(ModelForm):
    myfield = fields.CharField(required=True)
    relatedItems = FormSetField(RelatedItem)

MyForm = FormWithSets(MyForm)

I then display the form for editing and fill in some relatedItems. If I forget 
to
enter anything in myfield when the form is reshown, the field has been removed, 
so I
cannot correct my mistake.

Original comment by tommytastic on 25 Apr 2009 at 12:14

GoogleCodeExporter commented 9 years ago
On http://aep-sample.appspot.com it works as expected. If I forget to enter a 
"Last
name", but select some employee I get an error for the missing "Last name", but 
all
entered values ("First name" and "Employee") stay unmodified. No fields get 
lost,
there's nothing wrong that I can see. Can you reproduce it on the sample 
project's
website?

Original comment by wkornew...@gmail.com on 26 Apr 2009 at 10:20