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
c88381f2
"...static_src/src/sass/git@code.librehq.com:ots/hypha.git" did not exist on "8283dd6f922932d1c7757bf1e8a56a81f460e905"
Commit
c88381f2
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Allow the __iter__ method to return display objects
parent
4a498690
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/stream_forms/forms.py
+16
-7
16 additions, 7 deletions
opentech/apply/stream_forms/forms.py
with
16 additions
and
7 deletions
opentech/apply/stream_forms/forms.py
+
16
−
7
View file @
c88381f2
...
@@ -16,14 +16,23 @@ class MixedFieldMetaclass(DeclarativeFieldsMetaclass):
...
@@ -16,14 +16,23 @@ class MixedFieldMetaclass(DeclarativeFieldsMetaclass):
class
StreamBaseForm
(
BaseForm
,
metaclass
=
MixedFieldMetaclass
):
class
StreamBaseForm
(
BaseForm
,
metaclass
=
MixedFieldMetaclass
):
def
swap_fields_for_display
(
func
):
def
wrapped
(
self
,
*
args
,
**
kwargs
):
# Replaces the form fields with the display fields
# should only add new streamblocks and wont affect validation
fields
=
self
.
fields
.
copy
()
self
.
fields
=
self
.
display
yield
from
func
(
self
,
*
args
,
**
kwargs
)
self
.
fields
=
fields
return
wrapped
@swap_fields_for_display
def
__iter__
(
self
):
yield
from
super
().
__iter__
()
@swap_fields_for_display
def
_html_output
(
self
,
*
args
,
**
kwargs
):
def
_html_output
(
self
,
*
args
,
**
kwargs
):
# Replaces the form fields with the display fields
return
super
().
_html_output
(
*
args
,
**
kwargs
)
# should only add new streamblocks and wont affect validation
fields
=
self
.
fields
.
copy
()
self
.
fields
=
self
.
display
render
=
super
().
_html_output
(
*
args
,
**
kwargs
)
self
.
fields
=
fields
return
render
class
BlockFieldWrapper
:
class
BlockFieldWrapper
:
...
...
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