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
3f81884f
Commit
3f81884f
authored
6 years ago
by
Parbhat Puri
Committed by
Fredrik Jonsson
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Initial data for fields of group 1 from open call submission
parent
494907c0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/funds/models/applications.py
+54
-2
54 additions, 2 deletions
opentech/apply/funds/models/applications.py
opentech/public/funds/templates/public_funds/open_call_index_page.html
+1
-1
1 addition, 1 deletion
...ic/funds/templates/public_funds/open_call_index_page.html
with
55 additions
and
3 deletions
opentech/apply/funds/models/applications.py
+
54
−
2
View file @
3f81884f
...
@@ -17,6 +17,7 @@ from django.db.models import (
...
@@ -17,6 +17,7 @@ from django.db.models import (
When
,
When
,
)
)
from
django.db.models.functions
import
Coalesce
,
Length
from
django.db.models.functions
import
Coalesce
,
Length
from
django.shortcuts
import
render
from
django.http
import
Http404
from
django.http
import
Http404
from
django.utils.functional
import
cached_property
from
django.utils.functional
import
cached_property
...
@@ -36,6 +37,7 @@ from wagtail.core.models import Page, PageManager, PageQuerySet
...
@@ -36,6 +37,7 @@ from wagtail.core.models import Page, PageManager, PageQuerySet
from
..admin_forms
import
RoundBasePageAdminForm
,
WorkflowFormAdminForm
from
..admin_forms
import
RoundBasePageAdminForm
,
WorkflowFormAdminForm
from
..edit_handlers
import
ReadOnlyPanel
,
ReadOnlyInlinePanel
from
..edit_handlers
import
ReadOnlyPanel
,
ReadOnlyInlinePanel
from
..workflow
import
OPEN_CALL_PHASES
from
.submissions
import
ApplicationSubmission
from
.submissions
import
ApplicationSubmission
from
.utils
import
admin_url
,
EmailForm
,
SubmittableStreamForm
,
WorkflowStreamForm
,
LIMIT_TO_REVIEWERS
,
LIMIT_TO_STAFF
from
.utils
import
admin_url
,
EmailForm
,
SubmittableStreamForm
,
WorkflowStreamForm
,
LIMIT_TO_REVIEWERS
,
LIMIT_TO_STAFF
...
@@ -280,9 +282,59 @@ class RoundBase(WorkflowStreamForm, SubmittableStreamForm): # type: ignore
...
@@ -280,9 +282,59 @@ class RoundBase(WorkflowStreamForm, SubmittableStreamForm): # type: ignore
raise
ValidationError
(
error
)
raise
ValidationError
(
error
)
def
serve
(
self
,
request
):
def
get_form_parameters
(
self
,
request
=
None
):
form_parameters
=
{}
initial_values
=
{}
if
request
:
copy_open_submission
=
request
.
GET
.
get
(
'
open_call_submission
'
)
if
copy_open_submission
:
submission_class
=
self
.
get_submission_class
()
try
:
submission
=
submission_class
.
objects
.
get
(
id
=
copy_open_submission
)
if
self
.
get_parent
().
id
==
submission
.
page
.
id
:
first_group_blocks
=
submission
.
first_group_normal_blocks
for
field_id
in
first_group_blocks
:
field_data
=
submission
.
data
(
field_id
)
initial_values
[
field_id
]
=
field_data
form_parameters
[
'
initial
'
]
=
initial_values
except
(
submission_class
.
DoesNotExist
,
ValueError
):
pass
return
form_parameters
def
get_form
(
self
,
*
args
,
**
kwargs
):
form_class
=
self
.
get_form_class
()
request
=
kwargs
.
pop
(
'
request
'
,
None
)
if
request
:
form_params
=
self
.
get_form_parameters
(
request
=
request
)
else
:
form_params
=
self
.
get_form_parameters
()
form_params
.
update
(
kwargs
)
return
form_class
(
*
args
,
**
form_params
)
def
serve
(
self
,
request
,
*
args
,
**
kwargs
):
if
hasattr
(
request
,
'
is_preview
'
)
or
hasattr
(
request
,
'
show_round
'
):
if
hasattr
(
request
,
'
is_preview
'
)
or
hasattr
(
request
,
'
show_round
'
):
return
super
().
serve
(
request
)
# Overriding serve method to pass request to get_form method
if
request
.
method
==
'
POST
'
:
form
=
self
.
get_form
(
request
.
POST
,
request
.
FILES
,
page
=
self
,
user
=
request
.
user
)
if
form
.
is_valid
():
form_submission
=
self
.
process_form_submission
(
form
)
return
self
.
render_landing_page
(
request
,
form_submission
,
*
args
,
**
kwargs
)
else
:
form
=
self
.
get_form
(
page
=
self
,
user
=
request
.
user
,
request
=
request
)
context
=
self
.
get_context
(
request
)
context
[
'
form
'
]
=
form
return
render
(
request
,
self
.
get_template
(
request
),
context
)
# We hide the round as only the open round is used which is displayed through the
# We hide the round as only the open round is used which is displayed through the
# fund page
# fund page
...
...
This diff is collapsed.
Click to expand it.
opentech/public/funds/templates/public_funds/open_call_index_page.html
+
1
−
1
View file @
3f81884f
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
{% for submission in open_call_submissions %}
{% for submission in open_call_submissions %}
<div
class=
"listing listing--not-a-link"
>
<div
class=
"listing listing--not-a-link"
>
<h4
class=
"listing__title"
>
{{ submission.title }}
</h4>
<h4
class=
"listing__title"
>
{{ submission.title }}
</h4>
<a
class=
"listing__button"
href=
"{% pageurl submission.page %}"
>
Build it
</a>
<a
class=
"listing__button"
href=
"{% pageurl submission.page %}
?open_call_submission={{ submission.id }}
"
>
Build it
</a>
</div>
</div>
<div>
<div>
<div>
<div>
...
...
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