Hi,
It is supposed to work. It needs testing though (I personally don't
use this kind of automated form). Please let me know if you have any
issues.
-- rodrigo
It is supposed to work. It needs a lot of testing, though (I
first issue:
In the request handler:
self.MemberForm = model_form(Member)
def get(self, **kwargs):
context = {}
context['form'] = self.MemberForm(obj=member, field_args={
'first_name': {
'label':'Vorname',
},
})
In the template:
<td>{{ form.first_name.label }}:<td>{{ form.first_name() }}
Yields as a result:
<td><label for="first_name">First Name</label>:<td><input
id="first_name" name="first_name" type="text" value="" />
Where the label should be "Vorname" instead of "First Name" according
to the documentation in the source code right?
even though the generated code was
<td><label for="first_name">First Name</label>:<td><input
id="first_name" name="first_name" type="text" value="" />
where the input is definitely not a textarea, in my handler I have
form = self.MemberForm(request.form)
member.first_name = form.first_name
I am not sure about "requets.form" as argument for the constructor.
The error on post is:
** BadValueError: Property first_name must be a str or unicode
instance, not a TextField **
I have TextField in the form, but "first_name" is not.
One minor thing: Should "model_form" to be found in
from tipfy.ext.model.form import model_form
or
from wtforms.ext.appengine.db import model_form
Right now there is no model in tipfy.ext in the tarball.
Thanks a lot!
/ruben
I realize, that I probably cannot rely on the latest tarball to get
access to a working model_form but I should rather checkout the source
and use
tipfy.ext.model.form:model_form right?
Sorry for that!
I guess this will solve my issues ...
Hey ruben,
The module is now part of wtforms (although initially it was part of
tipfy). The docblock was never updated to reflect this, now I
realized. So the import you should use is:
from wtforms.ext.appengine.db import model_form
-- rodrigo