Make GMBA narrow boolean field

This commit is contained in:
PCoder 2022-01-13 10:07:06 +05:30
parent 9d022c6d3e
commit 1c78f6d8e3
3 changed files with 5 additions and 2 deletions

View file

@ -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',
)

View file

@ -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'] == '':

View file

@ -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)