From 9d9ae83994aa3ef4992cece0e4cdafc435d9934e Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 10 Jan 2024 17:25:44 +0000 Subject: [PATCH] highlight if a dataset was automatically converted --- hub/templates/hub/area.html | 9 +++++++++ hub/views/area.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/hub/templates/hub/area.html b/hub/templates/hub/area.html index 054eb52b2..c6e6f33ea 100644 --- a/hub/templates/hub/area.html +++ b/hub/templates/hub/area.html @@ -311,6 +311,9 @@

{{ dataset.label }}

{% endfor %} @@ -380,6 +383,9 @@

{{ dataset.label }}

{% endfor %} @@ -472,6 +478,9 @@

{{ dataset.label }}

{% endfor %} diff --git a/hub/views/area.py b/hub/views/area.py index 4917b368f..fbc70204a 100644 --- a/hub/views/area.py +++ b/hub/views/area.py @@ -11,6 +11,7 @@ AreaData, AreaType, DataSet, + DataType, Person, PersonData, UserDataSets, @@ -56,6 +57,13 @@ def process_dataset(self, data_set): .annotate(is_favourite=Count("id")) .values("is_favourite") ) + data_type = DataType.objects.filter( + data_set=data_set, area_type=self.object.area_type + ).first() + auto_converted = False + if data_type is not None: + auto_converted = data_type.auto_converted + base_qs = AreaData.objects.filter( area=self.object, data_type__data_set=data_set, @@ -73,6 +81,7 @@ def process_dataset(self, data_set): "data_type": data_set.data_type, "featured": data_set.featured, "excluded_countries": data_set.exclude_countries, + "auto_converted": auto_converted, } if data_set.is_range: data["is_range"] = True