Merge remote-tracking branch 'ungleich-public/master'

This commit is contained in:
PCoder 2022-01-17 23:56:17 +05:30
commit 0e5a7fb2c8
8 changed files with 112 additions and 18 deletions

View file

@ -151,10 +151,10 @@ class RangeCountryInline(admin.TabularInline):
class RangeAdmin(admin.ModelAdmin):
autocomplete_fields = ['mother_range']
inlines = [
RangeNameTranslationInline,
RangeCountryInline
]
# inlines = [
# RangeNameTranslationInline,
# RangeCountryInline
# ]
readonly_fields = ('id', 'gmba_v2_id')
search_fields = ['name', 'range_name', 'range_name_ascii',
'level', 'level', 'level_1', 'level_2', 'level_3', 'peak_name', 'comments', 'source',
@ -162,12 +162,11 @@ class RangeAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': (
('gmba_v2_id', 'range_name', 'range_name_language', 'map_unit'),
('range_name_map', 'select_300', 'checked'),
('range_name_ascii', 'GMBA_v1_id'),
('latitude', 'longitude'),
('mother_range', 'wiki_data_id', 'area'),
('feature', 'range_alternate_id', 'gmba_narrow'),
('gmba_v2_id', 'range_name', 'range_name_language'),
('map_unit', 'feature', 'gmba_narrow', 'select_300'),
('range_name_map', 'range_name_ascii', 'GMBA_v1_id'),
('latitude', 'longitude', 'area'),
('mother_range', 'countries', 'wiki_data_id', 'wiki_data_url'),
'source',
'id',
)
@ -179,13 +178,12 @@ class RangeAdmin(admin.ModelAdmin):
('name_ru', 'name_tr', 'name_cn')
)
}),
('Range Countries', {
'classes': ('collapse',),
'fields': ('countries',),
}),
('Comments', {
'classes': ('collapse',),
'fields': ('comments',),
}),
('Others', {
'fields': ('range_alternate_id', )
})
)
list_display = ['range_name', 'mother_range', 'countries']

View file

@ -452,6 +452,12 @@ def handle_object_dict(object_dict, model_name, debug=False):
for i in ['checked']:
if i in object_dict:
object_dict[i] = True if object_dict[i].lower().strip() == 'true' else 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

@ -0,0 +1,18 @@
# Generated by Django 4.0.1 on 2022-01-13 04:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0051_auto_20220104_1608'),
]
operations = [
migrations.AlterField(
model_name='mountainrange',
name='select_300',
field=models.BooleanField(blank=True, max_length=12, null=True),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 4.0.1 on 2022-01-13 04:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0052_alter_mountainrange_select_300'),
]
operations = [
migrations.AlterField(
model_name='mountainrange',
name='select_300',
field=models.BooleanField(default=False),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 4.0.1 on 2022-01-13 04:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0053_alter_mountainrange_select_300'),
]
operations = [
migrations.AlterField(
model_name='mountainrange',
name='gmba_narrow',
field=models.BooleanField(default=False, verbose_name='GMBA Standard'),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 4.0.1 on 2022-01-13 04:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0054_alter_mountainrange_gmba_narrow'),
]
operations = [
migrations.AlterField(
model_name='mountainrange',
name='wiki_data_url',
field=models.URLField(blank=True, null=True),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 4.0.1 on 2022-01-13 05:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0055_alter_mountainrange_wiki_data_url'),
]
operations = [
migrations.AlterField(
model_name='mountainrange',
name='range_alternate_id',
field=models.CharField(blank=True, max_length=128, null=True),
),
]

View file

@ -113,14 +113,14 @@ class MountainRange(models.Model):
comments = models.TextField(blank=True, null=True)
checked = models.BooleanField(default=False)
source = models.TextField(blank=True, null=True)
range_alternate_id = models.TextField(blank=True, null=True)
range_alternate_id = models.CharField(blank=True, null=True, max_length=128)
geologic_region = models.TextField(blank=True, null=True)
gmba_v2_id = models.PositiveIntegerField(blank=True, null=True)
gmba_v2_id_str = models.TextField(blank=True, null=True)
wiki_data_id = models.CharField(blank=True, null=True, max_length=25)
wiki_data_url = models.TextField(blank=True, null=True)
select_300 = models.CharField(blank=True, null=True, max_length=12)
gmba_narrow = models.CharField(blank=True, null=True, max_length=12)
wiki_data_url = models.URLField(blank=True, null=True)
select_300 = models.BooleanField(default=False)
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)