понедельник, 24 сентября 2012 г., 23:51:21 UTC+6 пользователь Massimo Di
Pierro написал:
>
> db should be defined in your models/db.py
>
> db= DAL(....)
>
> Models are executed in alphabetical order. It will not be there for you if
> you deleted db.py or name your model so that it is executed before db.py.
>
> Massimo
>
> On Monday, 24 September 2012 05:26:26 UTC-5, Роман Акимов 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
>> Thanks to all. Your help is very important. There was a problem:
>>
> def edit_doc():
doc = db.document_body(request.args(0)) or redirect(URL('docum'))
form = Crud.update(1,db.document_body, doc, next='docum')
return dict(form=form)
I catch error:
unbound method update() must be called with Crud instance as first argument
(got int instance instead)
But the text I wrote on the official documentation.
What am I doing wrong
--