Commit ca129a04 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Fix to run with web2py 2.14.5 + pydal 16.03, break backward compatibility.

parent ed9cde73
......@@ -46,23 +46,10 @@ db.define_table("publications",
Field("id_categories", 'reference categories', default=undef_id, label='AERES'),
migrate="publications.table")
# use different techniques to define foreign field
db.publications.id_categories.requires = \
IS_IN_DB(db, 'categories.id', 'categories.code')
IS_IN_DB(db, 'categories.id', 'categories.code')
db.publications.id_collaborations.requires = \
IS_IN_DB(db, 'collaborations.id', 'collaborations.collaboration')
db.publications.id_publishers.requires = IS_IN_DB(db, 'publishers.abbreviation')
db.publications.id_countries.requires = \
IS_IN_DB(db, 'countries.id', 'countries.country')
db.publications.id_publishers.requires = \
IS_IN_DB(db, 'publishers.id', 'publishers.abbreviation')
db.publications.id_projects.requires = \
IS_IN_DB(db, 'projects.id', 'projects.project')
db.publications.id_reports.requires = \
IS_IN_DB(db, 'reports.id', 'reports.type')
db.publications.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
\ No newline at end of file
db.publications.id_projects.requires = IS_IN_DB(db, db.projects.project)
......@@ -357,14 +357,15 @@ def get_foreign_field(field):
for vdt in validators:
if isinstance(vdt, IS_IN_DB):
# IS_IN_DB contains only the parent field.
# The key for the left join is the id key of the parent table
if len(vdt.ks) == 1:
return (vdt.ktable, vdt.ks[0], 'id')
if len(vdt.fieldnames) == 1:
return (vdt.ktable, vdt.fieldnames[0], 'id')
# IS_IN_DB contains the key for the join and the parent field
else:
return (vdt.ktable, vdt.ks[0], vdt.ks[1])
return (vdt.ktable, vdt.fieldnames[0], vdt.fieldnames[1])
# IS_IN_DB is not use.
# The parent key for the left join is the id key of the parent table
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment