Hi all.

I'm having an issue with an SQLFORM.gird query. I have a table where one of 
the columns references another table. Here are the table definitions:

db.define_table('osrwhitelistpool',
    Field('id', type='id'),
    Field('pool', type='string', length=255, unique=True),
    Field('wltype', type='reference osrwlpooltype'),
    Field('comments', type='string', length=255),
    Field('ctime', type='datetime', default=request.now))

db.define_table('osrwlpooltype',
    Field('id', type='id'),
    Field('wtype', type='string', length=32, unique=True))

So osrwhitelistpool field wltype references osrwlpooltype field wtype.

When I run a simple query, just requesting the whole table I get an error Query 
Not Supported: invalid literal for long() with base 10: 'ALL'

I'm not sure why it thinks that field should be a long.

Here are the table definitions directly from the DB:

osrtest=# \d osrwlpooltype
Table "osrtest.osrwlpooltype"
 Column |         Type          |                        Modifiers
--------+-----------------------+----------------------------------------------------------
 id     | integer               | not null default 
nextval('osrwlpooltypeseqpk'::regclass)
 wtype  | character varying(32) | not null
Indexes:
    "osrwlpooltype_pkey" PRIMARY KEY, btree (id)
    "osrwlpooltype_wtype_key" UNIQUE CONSTRAINT, btree (wtype)
Referenced by:
    TABLE "osrwhitelistpool" CONSTRAINT "osrwhitelistpool_wltype_fkey" 
FOREIGN KEY (wltype) REFERENCES osrwlpooltype(wtype)

osrtest=# \d osrwhitelistpool
Table "osrtest.osrwhitelistpool"
  Column  |            Type             |                          Modifiers
----------+-----------------------------+-------------------------------------------------------------
 id       | integer                     | not null default 
nextval('osrwhitelistpoolseqpk'::regclass)
 pool     | character varying(255)      | not null
 wltype   | character varying           |
 comments | character varying(255)      |
 ctime    | timestamp without time zone | default now()
Indexes:
    "osrwhitelistpool_pkey" PRIMARY KEY, btree (id)
    "osrwhitelistpool_pool_key" UNIQUE CONSTRAINT, btree (pool)
Foreign-key constraints:
    "osrwhitelistpool_wltype_fkey" FOREIGN KEY (wltype) REFERENCES 
osrwlpooltype(wtype)



I changed the table definition in db.py to 

db.define_table('osrwhitelistpool',
    Field('id', type='id'),
    Field('pool', type='string', length=255, unique=True),
    Field('wltype', type='string'),
    Field('comments', type='string', length=255),
    Field('ctime', type='datetime', default=request.now))

and it worked to display it. But then when I edit a record it is just a 
free form text field instead of a dropdown with the wtype field from 
osrwlpooltype.

Any ideas what I'm doing wrong?

Thanks,
Jim

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to