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
cfc5cffe
Commit
cfc5cffe
authored
13 years ago
by
tux091
Browse files
Options
Downloads
Patches
Plain Diff
Backport the 0.5.x syntax for FieldsModifier
parent
d72c5fe7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
models/db_widgets.py
+13
-10
13 additions, 10 deletions
models/db_widgets.py
modules/plugin_dbui/cfgsvc.py
+3
-0
3 additions, 0 deletions
modules/plugin_dbui/cfgsvc.py
modules/plugin_dbui/fieldsmodifier.py
+4
-9
4 additions, 9 deletions
modules/plugin_dbui/fieldsmodifier.py
with
20 additions
and
19 deletions
models/db_widgets.py
100644 → 100755
+
13
−
10
View file @
cfc5cffe
...
@@ -37,16 +37,19 @@ dbui.configure_grids(db, plugins=['pGridRowEditor',
...
@@ -37,16 +37,19 @@ dbui.configure_grids(db, plugins=['pGridRowEditor',
#
#
# Create composite fields for the publication form
# Create composite fields for the publication form
#
#
fm
=
dbui
.
FieldModifier
(
'
publications
'
)
fieldsModifier
=
dbui
.
FieldsModifier
(
'
publications
'
)
fm
.
configure_field
(
'
year
'
,
maxValue
=
datetime
.
now
().
year
)
fieldsModifier
.
configure_field
(
'
year
'
,
maxValue
=
datetime
.
now
().
year
)
fm
.
merge_fields
(
'
first_page
'
,
'
last_page
'
,
fieldsModifier
.
merge_fields
(
'
first_page
'
,
extjs
=
{
'
fieldLabel
'
:
T
(
'
Pages
'
),
'
defaults
'
:
{
'
flex
'
:
1
}})
'
last_page
'
,
fieldLabel
=
T
(
'
Pages
'
),
fm
.
merge_fields
(
'
conference_start
'
,
defaults
=
{
'
flex
'
:
1
})
'
conference_end
'
,
extjs
=
{
'
fieldLabel
'
:
T
(
'
Dates
'
),
'
defaults
'
:
{
'
flex
'
:
1
}})
fieldsModifier
.
merge_fields
(
'
conference_start
'
,
'
conference_end
'
,
fieldLabel
=
T
(
'
Dates
'
),
defaults
=
{
'
flex
'
:
1
})
#
#
# Create fieldSet for the publication form
# Create fieldSet for the publication form
...
...
This diff is collapsed.
Click to expand it.
modules/plugin_dbui/cfgsvc.py
100644 → 100755
+
3
−
0
View file @
cfc5cffe
...
@@ -64,6 +64,8 @@ class CfgSvc(BaseSvc):
...
@@ -64,6 +64,8 @@ class CfgSvc(BaseSvc):
See the documentation of the Ext.form.Compositefield class for details.
See the documentation of the Ext.form.Compositefield class for details.
"""
"""
# handle composite field and fieldsets
field_modifiers
=
self
.
environment
[
'
plugins
'
].
dbui
.
field_modifiers
field_modifiers
=
self
.
environment
[
'
plugins
'
].
dbui
.
field_modifiers
if
tablename
in
field_modifiers
:
if
tablename
in
field_modifiers
:
field_modifier
=
field_modifiers
[
tablename
]
field_modifier
=
field_modifiers
[
tablename
]
...
@@ -74,6 +76,7 @@ class CfgSvc(BaseSvc):
...
@@ -74,6 +76,7 @@ class CfgSvc(BaseSvc):
elif
fieldname
not
in
field_modifier
.
composite_fields
.
others
:
elif
fieldname
not
in
field_modifier
.
composite_fields
.
others
:
li
.
append
(
self
.
_get_form_field
(
tablename
,
fieldname
))
li
.
append
(
self
.
_get_form_field
(
tablename
,
fieldname
))
# handle basic field
else
:
else
:
li
.
append
(
self
.
_get_form_field
(
tablename
,
fieldname
))
li
.
append
(
self
.
_get_form_field
(
tablename
,
fieldname
))
...
...
This diff is collapsed.
Click to expand it.
modules/plugin_dbui/fieldsmodifier.py
+
4
−
9
View file @
cfc5cffe
...
@@ -62,24 +62,19 @@ class FieldsModifier(Modifier):
...
@@ -62,24 +62,19 @@ class FieldsModifier(Modifier):
Each field is identified by its database field name.
Each field is identified by its database field name.
The keyword argument
ExtJS
contains the configuration options of
The keyword argument
s
contains the configuration options of
the Ext.form.CompositeField widget.
the Ext.form.CompositeField widget.
"""
"""
extjs
=
{}
if
'
extjs
'
in
kwargs
:
extjs
.
update
(
kwargs
[
'
extjs
'
])
# define the main field as the first field in the list
main_field
=
fields
[
0
]
main_field
=
fields
[
0
]
other_fields
=
fields
[
1
:]
other_fields
=
fields
[
1
:]
# NOTE
# In order to simplify the processing keep a list of
# In order to simplify the processing keep a list of
# the main field, the first field appearing in the composite field,
# the main field and a list of the other fields.
# and a list of the other fields.
self
.
data
.
composite_fields
.
main
.
append
(
main_field
)
self
.
data
.
composite_fields
.
main
.
append
(
main_field
)
self
.
data
.
composite_fields
.
others
.
extend
(
other_fields
)
self
.
data
.
composite_fields
.
others
.
extend
(
other_fields
)
di
=
Storage
(
fields
=
fields
,
extjs
=
extj
s
)
di
=
Storage
(
fields
=
fields
,
extjs
=
kwarg
s
)
self
.
data
.
composite_fields
[
main_field
]
=
di
self
.
data
.
composite_fields
[
main_field
]
=
di
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