what do you mean by?
SQLField('price','double',db.add_product.price)
I think this should just be
Field('price','double')
and same for the other fields:
db.define_table('product',
SQLField('name'),
SQLField('category',db.category,
requires=IS_IN_DB(db,db.category.id,'%(name)s')),
SQLField('description'),
SQLField('small_image','upload'),
SQLField('large_image','upload'),
SQLField('quantity','integer'),
SQLField('price','double'))
On Sep 12, 4:11 pm, ukolo <[email protected]> wrote:
> Receiving the following error in my DB Setup and can't figure it out
>
> Traceback (most recent call last):
> File "gluon/restricted.py", line 186, in restricted
> exec ccode in environment
> File "/home/www-data/web2py/applications/Working/models/db.py", line
> 60, in <module>
> SQLField('price','double',db.add_product.price))
> File "gluon/sql.py", line 1359, in define_table
> t._create(migrate=migrate, fake_migrate=fake_migrate)
> File "gluon/sql.py", line 1716, in _create
> referenced = field.type[10:].strip()
> AttributeError: 'Expression' object has no attribute 'strip'
>
> this is the table
>
> db.define_table('product',
> SQLField('name',db.add_product.name),
> SQLField('category',db.category, requires=IS_IN_DB(db.category.id,
> db.category.name)),
> SQLField('description',db.add_product.description),
> SQLField('small_image','upload'),
> SQLField('large_image','upload',db.add_product.image),
> SQLField('quantity','integer',db.add_product.quantity),
> SQLField('price','double',db.add_product.price))
>
> Any help would be appreciated