On Mon, May 23, 2011 at 10:50 AM, Stifan Kristi <
[email protected]> wrote:

> ...
> === controller ===
> def blog_index():
>     for i, row in enumerate(rows):
>        if i == items_per_page: break
>
>        db.blog_comment.blog_id.default = row.id
>        form = crud.create(db.blog_comment,
>                             message = T('Record Inserted'))
>     return dict (form, rows.id, rows.title, rows.content)
>
>
I guess this code is an example, and not what you are trying to run! Since
your return dict makes no sense.

Regarding the forms, this will not work because in every loop iteration you
overwrite the default id and form. Thus, you will only send to the view the
last form you created.

You would need something like (untested):
def blog_index():
    forms = []
    for i, row in enumerate(rows):
        ...
        forms.append(crud.create(db.blog_comment, message = T('Record
Inserted')))
    return dict(forms=forms)

Miguel

Reply via email to