Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
VIPS
VIPSWeb
Commits
81d21a9b
Commit
81d21a9b
authored
1 year ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Handle empty list of available models
parent
3ed1ac21
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
spatial/templates/spatial/index.html
+7
-2
7 additions, 2 deletions
spatial/templates/spatial/index.html
spatial/views.py
+10
-5
10 additions, 5 deletions
spatial/views.py
with
17 additions
and
7 deletions
spatial/templates/spatial/index.html
+
7
−
2
View file @
81d21a9b
...
...
@@ -28,14 +28,19 @@
<h2>
VIPS grid map
</h2>
<p>
View results from VIPS models run on gridded weather data.
{% if available_grid_models|length > 0 %}
<ul>
{% for model in available_grid_models %}
{% for model in available_grid_models %}
<li><a
href=
"gridmap/{{model.model_id}}"
>
{{ model.model_name }}
</a></li>
{% endfor %}
{% endfor %}
</ul>
{% else %}
<p><em>
No GRID models available
</em></p>
{% endif %}
</p>
<h2>
Other resources
</h2>
<ul>
<li><a
href=
"test/PSILARTEMP"
>
Carrot rust fly map [TEST]
</a></li>
</ul>
{% endblock %}
This diff is collapsed.
Click to expand it.
spatial/views.py
+
10
−
5
View file @
81d21a9b
...
...
@@ -4,7 +4,9 @@ from django.conf import settings
def
index
(
request
):
context
=
{
"
available_grid_models
"
:
settings
.
AVAILABLE_GRID_MODELS
}
context
=
{
"
available_grid_models
"
:
settings
.
AVAILABLE_GRID_MODELS
if
hasattr
(
settings
,
"
AVAILABLE_GRID_MODELS
"
)
else
[]
}
return
render
(
request
,
'
spatial/index.html
'
,
context
)
def
psilartemp
(
request
):
...
...
@@ -12,9 +14,12 @@ def psilartemp(request):
return
render
(
request
,
'
spatial/psilartemp.html
'
,
context
)
def
gridmap
(
request
,
model_id
):
for
model
in
settings
.
AVAILABLE_GRID_MODELS
:
if
model_id
==
model
[
"
model_id
"
]:
context
=
{
"
model_id
"
:
model_id
}
return
render
(
request
,
'
spatial/gridmap.html
'
,
context
)
try
:
for
model
in
settings
.
AVAILABLE_GRID_MODELS
:
if
model_id
==
model
[
"
model_id
"
]:
context
=
{
"
model_id
"
:
model_id
}
return
render
(
request
,
'
spatial/gridmap.html
'
,
context
)
except
AttributeError
:
pass
return
index
(
request
)
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