Thanks for the reply. Unfortunately this code idea gives the same
result as mine.

On Dec 14, 2:51 am, pbreit <[email protected]> wrote:
> I would envision something more like this (not tested):
>
> == db.py ==
> db.define_table('address',
>     Field('person'),
>     Field('address'))
>
> == default.py ==
> def index():
>     records = db().select(db.address.ALL, orderby=db.address.name)
>     return dict(records=records)
>
> def create():
> form = SQLFORM(table)
> if form.accepts(request.post_vars, session):
>     session.flash = 'Address saved.'
>     redirect(URL('index'))
>
> == default/index.html ==
> {{extend 'layout.html'}}
> <h1>Addresses</h1>
> {{for record in records:}}
> {{=record.name}} : {{=record.address}}<br>
> {{pass}}
> [ {{=A('Add Address', _href=URL('create'))}} ]
>
> == default/create.html ==
> {{extend 'layout.html'}}
> {{=form}}

Reply via email to