Range: Make fields datatype similar to Access #9943

This commit is contained in:
PCoder 2021-11-28 13:06:35 +05:30
parent 194978b3e2
commit 8f3c9a91e7
3 changed files with 133 additions and 18 deletions

View file

@ -96,7 +96,19 @@ class ResourceAdmin(admin.ModelAdmin):
)
class RangeNameTranslationInline(admin.TabularInline):
model = RangeNameTranslation
class RangeCountryInline(admin.TabularInline):
model = RangeCountry
class RangeAdmin(admin.ModelAdmin):
inlines = [
RangeNameTranslationInline,
RangeCountryInline
]
readonly_fields = ('id',)
search_fields = ['name', 'range_name', 'range_name_ascii',
'level', 'level', 'level_1', 'level_2', 'level_3', 'peak_name', 'comments', 'source',

View file

@ -0,0 +1,103 @@
# Generated by Django 3.2.5 on 2021-11-28 07:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0036_alter_mountainrange_map_unit'),
]
operations = [
migrations.AlterField(
model_name='mountainrange',
name='GMBA_v1_id',
field=models.CharField(blank=True, max_length=25, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='area',
field=models.FloatField(blank=True, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='gmba_narrow',
field=models.CharField(blank=True, max_length=12, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='gmba_v2_id',
field=models.PositiveIntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='latitude',
field=models.DecimalField(blank=True, decimal_places=16, max_digits=22, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='longitude',
field=models.DecimalField(blank=True, decimal_places=16, max_digits=22, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='name_cn',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='name_de',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='name_es',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='name_fr',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='name_pt',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='name_ru',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='name_tr',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='range_name',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='range_name_ascii',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='range_name_map',
field=models.CharField(blank=True, max_length=128, null=True, unique=True),
),
migrations.AlterField(
model_name='mountainrange',
name='select_300',
field=models.CharField(blank=True, max_length=12, null=True),
),
migrations.AlterField(
model_name='mountainrange',
name='wiki_data_id',
field=models.CharField(blank=True, max_length=25, null=True),
),
]

View file

@ -88,9 +88,9 @@ class MountainRange(models.Model):
name = models.TextField(blank=True, null=True)
countries = models.TextField(blank=True, null=True)
range_name_map = models.TextField(blank=True, null=True, unique=True)
range_name = models.TextField(blank=True, null=True)
range_name_ascii = models.TextField(blank=True, null=True)
range_name_map = models.CharField(blank=True, null=True, unique=True, max_length=128)
range_name = models.CharField(blank=True, null=True, max_length=128)
range_name_ascii = models.CharField(blank=True, null=True, max_length=128)
range_name_language = models.ForeignKey(Language, models.DO_NOTHING, blank=True, null=True, to_field='id')
mother_range = models.ForeignKey("self", models.DO_NOTHING, blank=True, null=True, to_field='id')
feature = models.ForeignKey(RangeType, models.DO_NOTHING, blank=True, null=True, to_field='id')
@ -100,11 +100,11 @@ class MountainRange(models.Model):
level_1 = models.TextField(blank=True, null=True)
level_2 = models.TextField(blank=True, null=True)
level_3 = models.TextField(blank=True, null=True)
latitude = models.TextField(blank=True, null=True)
longitude = models.TextField(blank=True, null=True)
latitude = models.DecimalField(max_digits=22, decimal_places=16, blank=True, null=True)
longitude = models.DecimalField(max_digits=22, decimal_places=16, blank=True, null=True)
orogeny = models.TextField(blank=True, null=True)
area = models.TextField(blank=True, null=True)
GMBA_v1_id = models.TextField(blank=True, null=True)
area = models.FloatField(blank=True, null=True)
GMBA_v1_id = models.CharField(blank=True, null=True, max_length=25)
peak_elevation = models.TextField(blank=True, null=True)
peak_name = models.TextField(blank=True, null=True)
peak_latitude = models.TextField(blank=True, null=True)
@ -114,19 +114,19 @@ class MountainRange(models.Model):
source = models.TextField(blank=True, null=True)
range_alternate_id = models.TextField(blank=True, null=True)
geologic_region = models.TextField(blank=True, null=True)
gmba_v2_id = 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.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.TextField(blank=True, null=True)
gmba_narrow = models.TextField(blank=True, null=True)
name_fr = models.TextField(blank=True, null=True)
name_de = models.TextField(blank=True, null=True)
name_es = models.TextField(blank=True, null=True)
name_pt = models.TextField(blank=True, null=True)
name_cn = models.TextField(blank=True, null=True)
name_ru = models.TextField(blank=True, null=True)
name_tr = 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)
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)
name_pt = models.CharField(blank=True, null=True, max_length=128)
name_cn = models.CharField(blank=True, null=True, max_length=128)
name_ru = models.CharField(blank=True, null=True, max_length=128)
name_tr = models.CharField(blank=True, null=True, max_length=128)
perimeter = models.TextField(blank=True, null=True)
color_all = models.TextField(blank=True, null=True)
color_basic = models.TextField(blank=True, null=True)