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
340c12f1
Commit
340c12f1
authored
6 years ago
by
Fredrik Jonsson
Browse files
Options
Downloads
Patches
Plain Diff
Easier to read error message for fields that can only be included once.
parent
c7b95fa7
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/utils/blocks.py
+3
-1
3 additions, 1 deletion
opentech/apply/utils/blocks.py
with
3 additions
and
1 deletion
opentech/apply/utils/blocks.py
+
3
−
1
View file @
340c12f1
...
...
@@ -79,7 +79,7 @@ class CustomFormFieldsBlock(StreamBlock):
if
duplicates
:
all_errors
.
append
(
'
You have duplicates of the following non duplicate fields
: {}
'
.
format
(
'
,
'
.
join
(
prettify_names
(
duplicates
)))
'
The following fields must be included only once
: {}
'
.
format
(
'
,
'
.
join
(
prettify_names
(
duplicates
)))
)
for
i
,
block_name
in
enumerate
(
block_types
):
if
block_name
in
duplicates
:
...
...
@@ -117,6 +117,7 @@ class SingleIncludeStatic(StaticBlock):
"""
Helper block which displays additional information about the must include block and
helps display the error in a noticeable way.
"""
def
__init__
(
self
,
*
args
,
description
=
''
,
**
kwargs
):
self
.
description
=
description
super
().
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -155,6 +156,7 @@ class MustIncludeFieldBlock(SingleIncludeMixin, FormFieldBlock):
"""
Any block inheriting from this will need to be included in the application forms
This data will also be available to query on the submission object
"""
def
get_field_kwargs
(
self
,
struct_value
):
kwargs
=
super
().
get_field_kwargs
(
struct_value
)
kwargs
[
'
required
'
]
=
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