From ee634a2a659952d104816ab6de7c13e036294231 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 28 Nov 2021 12:21:08 +0530 Subject: [PATCH] Rename Range -> MountainRange --- app/admin.py | 4 ++-- .../0035_rename_range_mountainrange.py | 17 ++++++++++++++++ app/models.py | 20 +++++++++---------- app/views.py | 2 +- 4 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 app/migrations/0035_rename_range_mountainrange.py diff --git a/app/admin.py b/app/admin.py index 9a5b474..37ecc66 100644 --- a/app/admin.py +++ b/app/admin.py @@ -276,7 +276,7 @@ class RangeNameTranslationAdmin(admin.ModelAdmin): class PeopleRangeAdmin(admin.ModelAdmin): - model = Range + model = MountainRange list_display = ['person', 'range_name', ] def range_name(self, obj): @@ -316,7 +316,7 @@ class RangeCountryAdmin(admin.ModelAdmin): # Register your models here. admin.site.register(Person, PersonAdmin) admin.site.register(Resource, ResourceAdmin) -admin.site.register(Range, RangeAdmin) +admin.site.register(MountainRange, RangeAdmin) admin.site.register(Method) admin.site.register(Scale) admin.site.register(Taxon) diff --git a/app/migrations/0035_rename_range_mountainrange.py b/app/migrations/0035_rename_range_mountainrange.py new file mode 100644 index 0000000..73a5ffe --- /dev/null +++ b/app/migrations/0035_rename_range_mountainrange.py @@ -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', + ), + ] diff --git a/app/models.py b/app/models.py index 2b892cc..2af0ddd 100644 --- a/app/models.py +++ b/app/models.py @@ -76,7 +76,7 @@ class RangeType(models.Model): return self.range_type -class Range(models.Model): +class MountainRange(models.Model): id = models.AutoField(primary_key=True) source_id = models.IntegerField(blank=True, null=True) gmba_id = models.TextField(blank=True, null=True) @@ -394,7 +394,7 @@ class Organization(models.Model): class RangeOnlineInfo(models.Model): 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) url = models.TextField(blank=True, null=True) @@ -404,7 +404,7 @@ class RangeOnlineInfo(models.Model): class RangeNameTranslation(models.Model): 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) range_name_translation = models.TextField(blank=True, null=True) @@ -482,7 +482,7 @@ class NamesImport(models.Model): class ResourceRange(models.Model): id = models.AutoField(primary_key=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): return '%s, %s' % (self.resource_title.title, self.range_name.name) @@ -512,7 +512,7 @@ class Peak(models.Model): class Search(models.Model): 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) search_string = 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): id = models.AutoField(primary_key=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: db_table = 'ranges_people' @@ -715,7 +715,7 @@ class PeopleFunction(models.Model): class SpeciesRange(models.Model): id = models.AutoField(primary_key=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) source_url = models.TextField(blank=True, null=True) @@ -726,7 +726,7 @@ class SpeciesRange(models.Model): class PeopleRange(models.Model): id = models.AutoField(primary_key=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): return str(self.id) @@ -734,7 +734,7 @@ class PeopleRange(models.Model): class TaxonRange(models.Model): 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) subrange_or_region = 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): 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) def __str__(self): diff --git a/app/views.py b/app/views.py index 20e021d..6b3969c 100644 --- a/app/views.py +++ b/app/views.py @@ -21,7 +21,7 @@ from os import makedirs from tempfile import gettempdir from .formats import * 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 UPLOAD_PATH = gettempdir()