I have a self-referencing table [1] with a defined format for
representing a record in this fashion: "Lastname, Firstname
[yyyy-mm-dd]". In the father field, I expect it to display the drop-down
list of persons as defined in format, but it doesn't unless I define it
explicitly (like in the mother field).
Second, I tried dbset filter for the selection list of the father and
mother fields but I still get the whole table instead.
I'm trying this out on v1.99.2. What am I doing wrong here?
TIA
[1]
db.define_table('person'
,Field('birth_date', 'date', requires=IS_DATE())
,Field('last_name', notnull=True)
,Field('given_name', notnull=True)
,Field('middle_name', label="Mother's maiden name")
,Field('gender', 'integer', requires=IS_IN_SET(settings.gender,
zero='pick one'))
,Field('father', 'reference person'
,requires=IS_EMPTY_OR(IS_IN_DB(db('person.gender'==1),
'person.id'
,zero=T('pick one'))))
,Field('mother', 'reference person'
,requires=IS_EMPTY_OR(IS_IN_DB(db('person.gender'==2),
'person.id'
,'%(last_name)s, %(given_name)s
[%(birth_date)s]'
,zero=T('pick one'))))
,auth.signature
,format='%(last_name)s, %(given_name)s [%(birth_date)s]'
)