Commit 6042d547 authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Improving titles

parent ec2baaaf
......@@ -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))
......
......@@ -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",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment