Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
ca129a04
Commit
ca129a04
authored
May 09, 2016
by
LE GAC Renaud
Browse files
Fix to run with web2py 2.14.5 + pydal 16.03, break backward compatibility.
parent
ed9cde73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
20 deletions
+8
-20
models/db1_publications.py
models/db1_publications.py
+4
-17
modules/plugin_dbui/helper.py
modules/plugin_dbui/helper.py
+4
-3
No files found.
models/db1_publications.py
View file @
ca129a04
...
...
@@ -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
)
modules/plugin_dbui/helper.py
View file @
ca129a04
...
...
@@ -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
.
k
s
)
==
1
:
return
(
vdt
.
ktable
,
vdt
.
k
s
[
0
],
'id'
)
if
len
(
vdt
.
fieldname
s
)
==
1
:
return
(
vdt
.
ktable
,
vdt
.
fieldname
s
[
0
],
'id'
)
# IS_IN_DB contains the key for the join and the parent field
else
:
return
(
vdt
.
ktable
,
vdt
.
k
s
[
0
],
vdt
.
k
s
[
1
])
return
(
vdt
.
ktable
,
vdt
.
fieldname
s
[
0
],
vdt
.
fieldname
s
[
1
])
# IS_IN_DB is not use.
# The parent key for the left join is the id key of the parent table
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment