Gabriella, Does the problem go away if you define the pictures table before the route table?
On Wednesday, June 13, 2012 6:38:07 PM UTC-4, Gabriella Canavesi wrote: > > Yes off course :-) > It is just below the route table definition, here: > > db.define_table('pictures', > Field("picture", "upload", requires=(IS_NOT_EMPTY(), > IS_IMAGE())), > Field("normal", "upload", IS_IMAGE()), > Field("thumbnail", "upload", IS_IMAGE()), > Field('route_id', db.route, default=db.route.id), > Field('user_id', db.auth_user, default=auth.user_id), > Field('created_on', 'datetime', default=request.now), > Field('description', 'text', requires=[IS_TRIM(), > IS_LENGTH(140,error_message=T('Warning, description too long'))]) > ) > > paolo > > Il 14.06.2012 00:34 Massimo Di Pierro ha scritto: > > Do you have a > > > > db.define_table('pictures',....) > > > > ? > > > > On Wednesday, 13 June 2012 17:21:52 UTC-5, Gabriella Canavesi wrote: > > > >> Hi Niphlod, thanks you for the suggestion I solved even that error > >> and > >> I added > >> check_reserved=['common','postgres', 'sqlite'] to avoid future > >> problems. > >> > >> Unfortunately now I am getting an error saying: > >> > >> relation "pictures" does not exist > >> > >> which is the first field set as reference. > >> the table definition is the following: > >> > >> db.define_table('route', > >> Field('name', 'string', > >> requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'route.name [1]'), > >> IS_CAPITALIZE()]), > >> Field('user_id', db.auth_user, default=auth.user_id), > >> Field("slug", "string", > >> requires=[IS_SLUG(),IS_NOT_IN_DB(db,'route.slug')]), > >> Field('length','double', default=random.randint(0, 50)), > >> Field('height','integer', default=random.randint(0, 50)), > >> Field('max_elevation','integer', default=random.randint(0, > >> 50)), > >> Field('max_elevation_lat', 'double'), > >> Field('max_elevation_lgt', 'double'), > >> Field('min_elevation','integer', default=random.randint(0, > >> 50)), > >> Field('min_elevation_lat', 'double'), > >> Field('min_elevation_lgt', 'double'), > >> Field('start', 'string'), > >> Field('endC', 'string'), > >> Field('photo_id', 'reference pictures', readable=False, > >> writable=False), > >> Field("signs", 'reference signs', readable=False, > >> writable=False), > >> Field("kml", "upload", > >> uploadfolder=request.folder+'uploads/kml', uploadseparate=True), > >> Field("svg_altitude", 'string', readable=False, > >> writable=False), > >> Field("desc_it",'reference description', readable=False, > >> writable=False ), > >> Field("desc_en",'reference description', readable=False, > >> writable=False ), > >> Field("desc_de",'reference description', readable=False, > >> writable=False ), > >> Field("desc_es",'reference description', readable=False, > >> writable=False ), > >> Field("categories", 'list:reference route_category'), > >> Field("status", 'string', requires=IS_IN_SET(['public', > >> 'review', 'work_in_progress']), default='work_in_progress'), > >> auth.signature, > >> format='%(name)s (%(id)s)' > >> ) > >> > >> what should I do? > >> > >> -- > >> Paolo > >> > >> Il 13.06.2012 20:48 Niphlod ha scritto: > >>> yes, you're using "end" as column name....this is not allowed in > >>> postgres and oracle, and also on mssql. > >>> > >>> Bites me every time, but actually a good practice would be to > >> create > >>> the model within a connection made this way: > >>> > >>> db = DAL(uri, check_reserved_keyword=['all']) > >>> > >>> it will stop your model creation if find some tablename/columnname > >> > >>> that is not allowed in all db engines, so you can have a > >> "portable" > >>> db > >>> schema between different db engines. Better start with a > >> "universally > >>> accepted" model also in local developments with sqlite than having > >> > >>> those errors when trying to migrate to your production server. > >>> > >>> PS: check_reserved_keyword take a list of db engines to check > >>> against, > >>> so if you're worried only to "be portable" within postgres and > >>> sqlite, > >>> you can replace ['all'] with ['common', 'sqlite', 'postgres'] > > > > > > Links: > > ------ > > [1] http://route.name >