because you cannot ".accepts" a crud forms. It is implicit. You can do

def index():
   form = crud.create(db.contents,message='Inserted')
   return dict(form=form)



On Sep 9, 2:51 pm, Álvaro J. Iradier <airad...@gmail.com> wrote:
> Hi, I think I found a problem (bug?) with crud.create and
> form.custom.end:
>
> I have the following model:
>
> db.define_table('contents',
>    Field('name', 'string', required=True, notnull=True,
> requires=IS_NOT_EMPTY()),
>    Field('ordering', 'integer', required=True,
> requires=IS_NOT_EMPTY()),
>    Field('duration', 'integer', required=True,
> requires=IS_NOT_EMPTY()),
>    Field('enabled', 'boolean', required=True),
>    Field('file', 'upload', required=True, requires=IS_NOT_EMPTY(),
> autodelete=True)
> )
>
> The following controller:
>
> def index():
>    form = crud.create(db.contents)
>    if form.accepts(request.vars):
>        response.flash='Inserted'
>    return dict(form=form)
>
> and the serialization of form.custom.end is:
>
> <div class="hidden"><input name="_next" type="hidden" /><input
> name="_formkey" type="hidden"
> value="b1b19180-5226-48da-8d26-da29ed904177" /><input name="_formname"
> type="hidden" value="contents_create" /></div><div
> class="hidden"><input name="_next" type="hidden" /><input
> name="_formkey" type="hidden"
> value="b1b19180-5226-48da-8d26-da29ed904177" /><input name="_formname"
> type="hidden" value="contents/None" /></div></form>
>
> Notice the output is duplicated, specially "_formname" is repeated
> with a value of "contents/None", which makes the form not working.
>
> Am I doing something wrong, or is this a bug?
>
> Thanks very much.
>
> --
> (:=================================:)
>  Alvaro J. Iradier Muro - airad...@gmail.com

Reply via email to