Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin_dbui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
w2pext
plugin_dbui
Commits
ca129a04
Commit
ca129a04
authored
8 years ago
by
LE GAC Renaud
Browse files
Options
Downloads
Patches
Plain Diff
Fix to run with web2py 2.14.5 + pydal 16.03, break backward compatibility.
parent
ed9cde73
No related branches found
No related tags found
2 merge requests
!22
Release 0.8.3
,
!21
24 web2py 2.14.6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
models/db1_publications.py
+4
-17
4 additions, 17 deletions
models/db1_publications.py
modules/plugin_dbui/helper.py
+4
-3
4 additions, 3 deletions
modules/plugin_dbui/helper.py
with
8 additions
and
20 deletions
models/db1_publications.py
+
4
−
17
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
)
This diff is collapsed.
Click to expand it.
modules/plugin_dbui/helper.py
+
4
−
3
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment