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
1505f9ed
Commit
1505f9ed
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Make a shared base class for the funds and rounds
parent
331e75f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentech/apply/funds/models.py
+23
-18
23 additions, 18 deletions
opentech/apply/funds/models.py
with
23 additions
and
18 deletions
opentech/apply/funds/models.py
+
23
−
18
View file @
1505f9ed
...
...
@@ -38,23 +38,7 @@ def admin_url(page):
return
reverse
(
'
wagtailadmin_pages:edit
'
,
args
=
(
page
.
id
,))
class
FundType
(
AbstractStreamForm
):
parent_page_types
=
[
'
apply_home.ApplyHomePage
'
]
subpage_types
=
[
'
funds.Round
'
]
base_form_class
=
WorkflowFormAdminForm
WORKFLOWS
=
{
'
single
'
:
SingleStage
.
name
,
'
double
'
:
DoubleStage
.
name
,
}
workflow
=
models
.
CharField
(
choices
=
WORKFLOWS
.
items
(),
max_length
=
100
,
default
=
'
single
'
)
def
get_defined_fields
(
self
):
# Only return the first form, will need updating for when working with 2 stage WF
return
self
.
forms
.
all
()[
0
].
fields
class
AbstractApplicationStreamForm
(
AbstractStreamForm
):
def
get_submission_class
(
self
):
return
ApplicationSubmission
...
...
@@ -71,6 +55,27 @@ class FundType(AbstractStreamForm):
page
=
self
,
)
class
Meta
:
abstract
=
True
class
FundType
(
AbstractApplicationStreamForm
):
parent_page_types
=
[
'
apply_home.ApplyHomePage
'
]
subpage_types
=
[
'
funds.Round
'
]
base_form_class
=
WorkflowFormAdminForm
WORKFLOWS
=
{
'
single
'
:
SingleStage
.
name
,
'
double
'
:
DoubleStage
.
name
,
}
workflow
=
models
.
CharField
(
choices
=
WORKFLOWS
.
items
(),
max_length
=
100
,
default
=
'
single
'
)
def
get_defined_fields
(
self
):
# Only return the first form, will need updating for when working with 2 stage WF
return
self
.
forms
.
all
()[
0
].
fields
@property
def
workflow_class
(
self
):
return
WORKFLOW_CLASS
[
self
.
get_workflow_display
()]
...
...
@@ -122,7 +127,7 @@ class ApplicationForm(models.Model):
return
self
.
name
class
Round
(
AbstractStreamForm
):
class
Round
(
Abstract
Application
StreamForm
):
parent_page_types
=
[
'
funds.FundType
'
]
subpage_types
=
[]
# type: ignore
...
...
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