Rename Range -> MountainRange

This commit is contained in:
PCoder 2021-11-28 12:21:08 +05:30
parent 8c66f96a5f
commit ee634a2a65
4 changed files with 30 additions and 13 deletions

View file

@ -276,7 +276,7 @@ class RangeNameTranslationAdmin(admin.ModelAdmin):
class PeopleRangeAdmin(admin.ModelAdmin): class PeopleRangeAdmin(admin.ModelAdmin):
model = Range model = MountainRange
list_display = ['person', 'range_name', ] list_display = ['person', 'range_name', ]
def range_name(self, obj): def range_name(self, obj):
@ -316,7 +316,7 @@ class RangeCountryAdmin(admin.ModelAdmin):
# Register your models here. # Register your models here.
admin.site.register(Person, PersonAdmin) admin.site.register(Person, PersonAdmin)
admin.site.register(Resource, ResourceAdmin) admin.site.register(Resource, ResourceAdmin)
admin.site.register(Range, RangeAdmin) admin.site.register(MountainRange, RangeAdmin)
admin.site.register(Method) admin.site.register(Method)
admin.site.register(Scale) admin.site.register(Scale)
admin.site.register(Taxon) admin.site.register(Taxon)

View file

@ -0,0 +1,17 @@
# Generated by Django 3.2.5 on 2021-11-28 06:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0034_alter_person_gmba_function'),
]
operations = [
migrations.RenameModel(
old_name='Range',
new_name='MountainRange',
),
]

View file

@ -76,7 +76,7 @@ class RangeType(models.Model):
return self.range_type return self.range_type
class Range(models.Model): class MountainRange(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
source_id = models.IntegerField(blank=True, null=True) source_id = models.IntegerField(blank=True, null=True)
gmba_id = models.TextField(blank=True, null=True) gmba_id = models.TextField(blank=True, null=True)
@ -394,7 +394,7 @@ class Organization(models.Model):
class RangeOnlineInfo(models.Model): class RangeOnlineInfo(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
range_name = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True, to_field='range_name_map') range_name = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True, to_field='range_name_map')
info_source = models.TextField(blank=True, null=True) info_source = models.TextField(blank=True, null=True)
url = models.TextField(blank=True, null=True) url = models.TextField(blank=True, null=True)
@ -404,7 +404,7 @@ class RangeOnlineInfo(models.Model):
class RangeNameTranslation(models.Model): class RangeNameTranslation(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
range_name = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range_name = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True)
language_translation = models.ForeignKey(Language, models.DO_NOTHING, blank=True, null=True) language_translation = models.ForeignKey(Language, models.DO_NOTHING, blank=True, null=True)
range_name_translation = models.TextField(blank=True, null=True) range_name_translation = models.TextField(blank=True, null=True)
@ -482,7 +482,7 @@ class NamesImport(models.Model):
class ResourceRange(models.Model): class ResourceRange(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
resource_title = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True) resource_title = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True)
range_name = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range_name = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True)
def __str__(self): def __str__(self):
return '%s, %s' % (self.resource_title.title, self.range_name.name) return '%s, %s' % (self.resource_title.title, self.range_name.name)
@ -512,7 +512,7 @@ class Peak(models.Model):
class Search(models.Model): class Search(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
range_name = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range_name = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True)
repository = models.ForeignKey(Repository, models.DO_NOTHING, blank=True, null=True) repository = models.ForeignKey(Repository, models.DO_NOTHING, blank=True, null=True)
search_string = models.TextField(blank=True, null=True) search_string = models.TextField(blank=True, null=True)
search_date = models.TextField(blank=True, null=True) search_date = models.TextField(blank=True, null=True)
@ -659,7 +659,7 @@ class TaxaPeople(models.Model):
class RangesPeople(models.Model): class RangesPeople(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True)
class Meta: class Meta:
db_table = 'ranges_people' db_table = 'ranges_people'
@ -715,7 +715,7 @@ class PeopleFunction(models.Model):
class SpeciesRange(models.Model): class SpeciesRange(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
scientific_name = models.ForeignKey(Species, models.DO_NOTHING, blank=True, null=True) scientific_name = models.ForeignKey(Species, models.DO_NOTHING, blank=True, null=True)
range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True)
endemic = models.TextField(blank=True, null=True) endemic = models.TextField(blank=True, null=True)
source_url = models.TextField(blank=True, null=True) source_url = models.TextField(blank=True, null=True)
@ -726,7 +726,7 @@ class SpeciesRange(models.Model):
class PeopleRange(models.Model): class PeopleRange(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True)
def __str__(self): def __str__(self):
return str(self.id) return str(self.id)
@ -734,7 +734,7 @@ class PeopleRange(models.Model):
class TaxonRange(models.Model): class TaxonRange(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True)
taxon = models.TextField(blank=True, null=True) taxon = models.TextField(blank=True, null=True)
subrange_or_region = models.TextField(blank=True, null=True) subrange_or_region = models.TextField(blank=True, null=True)
taxon_status = models.TextField(blank=True, null=True) taxon_status = models.TextField(blank=True, null=True)
@ -774,7 +774,7 @@ class PeopleResource(models.Model):
class RangeCountry(models.Model): class RangeCountry(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True)
country = models.ForeignKey(Country, models.DO_NOTHING, blank=True, null=True) country = models.ForeignKey(Country, models.DO_NOTHING, blank=True, null=True)
def __str__(self): def __str__(self):

View file

@ -21,7 +21,7 @@ from os import makedirs
from tempfile import gettempdir from tempfile import gettempdir
from .formats import * from .formats import *
from .convert import reindex_data, refresh_data from .convert import reindex_data, refresh_data
from .models import Person, RangesPeople, TaxaPeople, FieldsPeople, MethodsPeople, Range, Field, Taxon, Resource from .models import Person, RangesPeople, TaxaPeople, FieldsPeople, MethodsPeople, MountainRange, Field, Taxon, Resource
# Get temporary file storage # Get temporary file storage
UPLOAD_PATH = gettempdir() UPLOAD_PATH = gettempdir()