Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hub
ViralHostRangeDB
Commits
6042d547
Commit
6042d547
authored
Sep 30, 2019
by
Bryan BRANCOTTE
Browse files
Improving titles
parent
ec2baaaf
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/viralhostrange/viralhostrangedb/models.py
View file @
6042d547
...
...
@@ -191,6 +191,13 @@ class DataSource(models.Model):
.
filter
(
name
=
GlobalViralHostResponseValue
.
get_not_mapped_yet_keyword
())
\
.
exists
()
@
property
def
is_mapping_absent
(
self
):
return
not
GlobalViralHostResponseValue
.
objects
\
.
filter
(
responseindatasource__data_source__pk
=
self
.
pk
)
\
.
filter
(
~
Q
(
name
=
GlobalViralHostResponseValue
.
get_not_mapped_yet_keyword
()))
\
.
exists
()
@
classmethod
def
get_not_mapped_data_sources
(
cls
,
*
,
owner
):
return
cls
.
objects
.
filter
(
pk__in
=
cls
.
get_not_mapped_data_sources_pk
(
owner
=
owner
))
...
...
src/viralhostrange/viralhostrangedb/views.py
View file @
6042d547
...
...
@@ -161,8 +161,12 @@ def data_source_mapping_edit(request, pk):
)
)
form
=
forms
.
MappingFormSet
(
initial
=
initial
)
if
data_source
.
is_mapping_absent
:
title
=
_
(
"Defining the mapping of data source
\"
%s
\"
"
)
%
data_source
.
name
else
:
title
=
_
(
"Updating the mapping of data source
\"
%s
\"
"
)
%
data_source
.
name
context
=
dict
(
title
=
_
(
"Updating the mapping of a data source"
)
,
title
=
title
,
form
=
form
,
medium_width
=
True
,
formset_css_classes
=
"mb-4 col-12 col-md-6 col-lg-4 col-xl-3"
,
...
...
@@ -194,8 +198,12 @@ def data_source_mapping_range_edit(request, pk):
.
values_list
(
'raw_response'
)
\
.
distinct
()
\
.
values_list
(
'raw_response'
,
flat
=
True
)
if
data_source
.
is_mapping_absent
:
title
=
_
(
"Defining the mapping of data source
\"
%s
\"
"
)
%
data_source
.
name
else
:
title
=
_
(
"Updating the mapping of data source
\"
%s
\"
"
)
%
data_source
.
name
context
=
dict
(
title
=
_
(
"Updating the mapping of a data source"
)
,
title
=
title
,
form
=
form
,
medium_width
=
True
,
formset_css_classes
=
"mb-4 col-12 col-md-6 col-lg-4 col-xl-3"
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment