Hi

I ran into this problem while following Massimo's book (btw, thanks for 
your efforts - it's good to have a chance to do this directly).

In 3.7 (Adding Crud), it wasn't obvious at first that the addition of crud 
should come AFTER the database ('db' in this case) is defined.

I moved the two crud statements in db.py to the end and the example is 
working nicely now.

Alex

On Monday, September 24, 2012 4:26:26 AM UTC-6, Роман Акимов wrote:
>
> Hello all!
> Please help me.
> I'm write:
>
> model
> db.define_table(
>     'document_body',
>     Field('name'),
>     Field('number'),
>     Field('created', 'datetime', default=request.now),
>     Field('start_date', 'date'),
>     Field('end_date', 'date'),
>     Field('activity', 'boolean', default=True),
>     )
>
> controller
> def index():
>     form = SQLFORM(db.document_body)
>     if form.process().accepted:
>         response.flash = 'document uploaded'
>     return dict(form = form)
>
> And i have error in default.py:
> <type 'exceptions.NameError'> global name 'db' is not defined
>
>

-- 



Reply via email to