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
a3267d12
Commit
a3267d12
authored
4 years ago
by
Shrikrishna Singh
Committed by
Fredrik Jonsson
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Check if all submissions has same type while creating batch determinations
parent
4be2250e
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
hypha/apply/determinations/models.py
+3
-1
3 additions, 1 deletion
hypha/apply/determinations/models.py
hypha/apply/determinations/views.py
+13
-0
13 additions, 0 deletions
hypha/apply/determinations/views.py
hypha/apply/review/forms.py
+1
-0
1 addition, 0 deletions
hypha/apply/review/forms.py
with
17 additions
and
1 deletion
hypha/apply/determinations/models.py
+
3
−
1
View file @
a3267d12
...
@@ -142,7 +142,9 @@ class Determination(DeterminationFormFieldsMixin, AccessFormData, models.Model):
...
@@ -142,7 +142,9 @@ class Determination(DeterminationFormFieldsMixin, AccessFormData, models.Model):
group
=
0
group
=
0
data
.
setdefault
(
group
,
{
'
title
'
:
None
,
'
questions
'
:
list
()})
data
.
setdefault
(
group
,
{
'
title
'
:
None
,
'
questions
'
:
list
()})
for
field
in
self
.
form_fields
:
for
field
in
self
.
form_fields
:
if
issubclass
(
field
.
block
.
__class__
,
DeterminationMustIncludeFieldBlock
):
if
issubclass
(
field
.
block
.
__class__
,
DeterminationMustIncludeFieldBlock
)
or
isinstance
(
field
.
block
,
SendNoticeBlock
):
continue
continue
try
:
try
:
value
=
self
.
form_data
[
field
.
id
]
value
=
self
.
form_data
[
field
.
id
]
...
...
This diff is collapsed.
Click to expand it.
hypha/apply/determinations/views.py
+
13
−
0
View file @
a3267d12
...
@@ -140,8 +140,21 @@ class BatchDeterminationCreateView(BaseStreamForm, CreateView):
...
@@ -140,8 +140,21 @@ class BatchDeterminationCreateView(BaseStreamForm, CreateView):
kwargs
.
pop
(
'
instance
'
)
kwargs
.
pop
(
'
instance
'
)
return
kwargs
return
kwargs
def
check_all_submissions_are_of_same_type
(
self
,
submissions
):
return
len
(
set
(
[
submission
.
is_determination_form_attached
for
submission
in
submissions
]
))
==
1
def
get_form_class
(
self
):
def
get_form_class
(
self
):
submissions
=
self
.
get_submissions
()
submissions
=
self
.
get_submissions
()
if
not
self
.
check_all_submissions_are_of_same_type
(
submissions
):
raise
ValueError
(
"
All selected submissions excpects determination forms attached
"
"
- please contact admin
"
)
if
not
submissions
[
0
].
is_determination_form_attached
:
if
not
submissions
[
0
].
is_determination_form_attached
:
return
get_form_for_stages
(
submissions
)
return
get_form_for_stages
(
submissions
)
form_fields
=
self
.
get_form_fields
()
form_fields
=
self
.
get_form_fields
()
...
...
This diff is collapsed.
Click to expand it.
hypha/apply/review/forms.py
+
1
−
0
View file @
a3267d12
...
@@ -42,6 +42,7 @@ class ReviewModelForm(StreamBaseForm, forms.ModelForm, metaclass=MixedMetaClass)
...
@@ -42,6 +42,7 @@ class ReviewModelForm(StreamBaseForm, forms.ModelForm, metaclass=MixedMetaClass)
initial
[
key
]
=
value
initial
[
key
]
=
value
super
().
__init__
(
*
args
,
initial
=
initial
,
instance
=
instance
,
**
kwargs
)
super
().
__init__
(
*
args
,
initial
=
initial
,
instance
=
instance
,
**
kwargs
)
for
field
in
self
.
_meta
.
widgets
:
for
field
in
self
.
_meta
.
widgets
:
self
.
fields
[
field
].
disabled
=
True
self
.
fields
[
field
].
disabled
=
True
...
...
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