Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LDV Specification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
ASTRON SDC
LDV Specification
Commits
7a580e8c
Commit
7a580e8c
authored
2 years ago
by
Fanna Lautenbach
Browse files
Options
Downloads
Patches
Plain Diff
add constraint and change error form for missing field key
parent
97938437
No related branches found
No related tags found
1 merge request
!51
add 'obs-id' as mandatory filter field
Pipeline
#41515
passed
2 years ago
Stage: test
Stage: build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ldvspec/lofardata/forms.py
+5
-0
5 additions, 0 deletions
ldvspec/lofardata/forms.py
ldvspec/lofardata/templates/lofardata/workspecification/create_update.html
+5
-1
5 additions, 1 deletion
.../templates/lofardata/workspecification/create_update.html
with
10 additions
and
1 deletion
ldvspec/lofardata/forms.py
+
5
−
0
View file @
7a580e8c
from
django.core.exceptions
import
ValidationError
from
.models
import
WorkSpecification
,
DataProductFilter
from
django.forms
import
ModelForm
...
...
@@ -20,6 +22,9 @@ class WorkSpecificationForm(ModelForm):
def
clean
(
self
):
self
.
cleaned_data
=
super
().
clean
()
self
.
cleaned_data
[
"
filters
"
]
=
self
.
_extract_filters
()
if
not
'
obs_id
'
in
self
.
cleaned_data
[
"
filters
"
]:
raise
ValidationError
([
"
You have forgotten about the
'
obs_id
'"
])
return
self
.
cleaned_data
class
Meta
:
...
...
This diff is collapsed.
Click to expand it.
ldvspec/lofardata/templates/lofardata/workspecification/create_update.html
+
5
−
1
View file @
7a580e8c
...
...
@@ -204,7 +204,11 @@
The input is invalid:
{% for field, errors in form.errors.items %}
{% for error in errors %}
<li
class=
"text text--red text--faded"
>
{{ field }}: {{ error }}
</li>
{% if field == '__all__' %}
<li
class=
"text text--red text--faded"
>
{{ error }}
</li>
{% else %}
<li
class=
"text text--red text--faded"
>
{{ field }}: {{ error }}
</li>
{% endif %}
{% endfor %}
{% endfor %}
</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