Very similar problem, but with an important difference: the referencing
table is the "user" table, an extension of it actually...
So I don't know how to resolve.
by the way, the behaviour is a little randomic: it works for some fields
but not for others.
At the moment "dipartimenti" is working as expected but "faxmachines"
doesn't...
Here my code:
db = DAL('mysql://user:[email protected]/dbname',
pool_size=myconf.take('db.pool_size', cast=int),
check_reserved=['all'],lazy_tables = True,)
auth.settings.table_user_name = 'users'
db.define_table('faxmachines',
Field('numero', length=14),
Field('name', length=100, requires=IS_NOT_EMPTY()),
Field('dominio', 'reference domini', writable=False,
readable=False, default=lambda:session.domain ),
Field('pin', length=8),
Field('label', length=60, requires=IS_NOT_EMPTY()),
Field('fmmail', length=50),
Field('fmenabled', 'boolean', default=True),
Field('enabled', 'boolean', default=True),
Format='%(name)s',
common_filter = lambda query:
db.fax_machines.dominio==session.domain,
#fake_migrate=True
)
db.define_table('dipartimenti',
Field('name', length=100, requires=IS_NOT_EMPTY()),
Field('dominio', 'reference domini', writable=False,
readable=False, default=lambda:session.domain ),
format='%(name)s',
common_filter = lambda query:
db.dipartimenti.dominio==session.domain,
#fake_migrate=True
)
db.define_table('domini',
Field('name', length=100,
requires=IS_NOT_EMPTY()),
Field('provisiong_folder',length=255,
requires=IS_NOT_EMPTY()),
Field('dialstring', length= 20),
format='%(name)s',
)
auth.settings.extra_fields['users']= [
Field('dominio', 'reference domini', writable=False,
readable=False, default=lambda:session.domain),
Field('faxmachine', 'reference faxmachines'),
Field('dipartimento', 'reference dipartimenti'),
Field('matricola', length= 50, requires=IS_NOT_EMPTY()),
Field('pin', length= 10 ),
Field('cellulare', length= 20 ),
Field('alternative', length= 20 ),
Field('note', length=255 ),
Field('enabled', 'boolean', default=True ),
]
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.