Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
ots
hypha
Commits
8bf71423
Commit
8bf71423
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Update for the inline read only form
parent
44ebd0e2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentech/apply/funds/edit_handlers.py
+16
-3
16 additions, 3 deletions
opentech/apply/funds/edit_handlers.py
with
16 additions
and
3 deletions
opentech/apply/funds/edit_handlers.py
+
16
−
3
View file @
8bf71423
...
@@ -46,7 +46,15 @@ class ReadOnlyPanel(EditHandler):
...
@@ -46,7 +46,15 @@ class ReadOnlyPanel(EditHandler):
def
__init__
(
self
,
attr
,
**
kwargs
):
def
__init__
(
self
,
attr
,
**
kwargs
):
self
.
attr
=
attr
self
.
attr
=
attr
super
().
__init__
(
**
kwargs
)
super
().
__init__
(
**
kwargs
)
self
.
heading
=
pretty_name
(
self
.
attr
)
if
self
.
heading
is
None
else
self
.
heading
self
.
heading
=
pretty_name
(
self
.
attr
)
if
not
self
.
heading
else
self
.
heading
def
clone
(
self
):
return
self
.
__class__
(
attr
=
self
.
attr
,
heading
=
self
.
heading
,
classname
=
self
.
classname
,
help_text
=
self
.
help_text
,
)
def
context
(
self
):
def
context
(
self
):
try
:
try
:
...
@@ -76,9 +84,14 @@ class ReadOnlyPanel(EditHandler):
...
@@ -76,9 +84,14 @@ class ReadOnlyPanel(EditHandler):
class
ReadOnlyInlinePanel
(
ReadOnlyPanel
):
class
ReadOnlyInlinePanel
(
ReadOnlyPanel
):
template
=
'
wagtailadmin/edit_handlers/multi_field_panel.html
'
template
=
'
wagtailadmin/edit_handlers/multi_field_panel.html
'
def
on_model_bound
(
self
,
model
):
def
get_child_edit_handler
(
self
):
child_edit_handler
=
ReadOnlyPanel
(
self
.
attr
)
return
child_edit_handler
.
bind_to_model
(
getattr
(
self
.
instance
,
self
.
attr
))
def
on_instance_bound
(
self
):
values
=
getattr
(
self
.
instance
,
self
.
attr
).
all
()
values
=
getattr
(
self
.
instance
,
self
.
attr
).
all
()
self
.
children
=
[
ReadOnlyPanel
(
value
,
form
=
self
.
form
)
for
value
in
values
]
child_panel
=
self
.
get_child_edit_handler
()
self
.
children
=
[
child_panel
.
bind_to_instance
(
value
,
form
=
self
.
form
)
for
value
in
values
]
class
FilteredFieldPanel
(
FieldPanel
):
class
FilteredFieldPanel
(
FieldPanel
):
...
...
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