From 1c78f6d8e324b7e1c78bfe94c00af4f9416bc1f5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 13 Jan 2022 10:07:06 +0530 Subject: [PATCH] Make GMBA narrow boolean field --- app/admin.py | 2 +- app/management/commands/import.py | 3 +++ app/models.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/admin.py b/app/admin.py index 9c0caf5..6050a74 100644 --- a/app/admin.py +++ b/app/admin.py @@ -162,7 +162,7 @@ class RangeAdmin(admin.ModelAdmin): ('range_name_ascii', 'GMBA_v1_id'), ('latitude', 'longitude'), ('mother_range', 'wiki_data_id', 'area'), - ('feature', 'range_alternate_id', 'gmba_narrow'), + ('feature', 'range_alternate_id'), 'source', 'id', ) diff --git a/app/management/commands/import.py b/app/management/commands/import.py index 5d3952e..e7d83cb 100644 --- a/app/management/commands/import.py +++ b/app/management/commands/import.py @@ -455,6 +455,9 @@ def handle_object_dict(object_dict, model_name, debug=False): for i in ['select_300']: if i in object_dict: object_dict[i] = True if object_dict[i].lower().strip() == 'x' else False + for i in ['gmba_narrow']: + if i in object_dict: + object_dict[i] = True if object_dict[i].lower().strip() == 'x' else False # area field can't be empty if 'area' in object_dict: if object_dict['area'] == '': diff --git a/app/models.py b/app/models.py index ea6b2c3..0f88bb4 100644 --- a/app/models.py +++ b/app/models.py @@ -120,7 +120,7 @@ class MountainRange(models.Model): wiki_data_id = models.CharField(blank=True, null=True, max_length=25) wiki_data_url = models.TextField(blank=True, null=True) select_300 = models.BooleanField(default=False) - gmba_narrow = models.CharField(blank=True, null=True, max_length=12) + gmba_narrow = models.BooleanField(default=False, verbose_name="GMBA Standard") name_fr = models.CharField(blank=True, null=True, max_length=128) name_de = models.CharField(blank=True, null=True, max_length=128) name_es = models.CharField(blank=True, null=True, max_length=128)