# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior # * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table # Feel free to rename the models, but don't rename db_table values or field names. from django.db import models class AlembicVersion(models.Model): version_num = models.TextField() class Meta: managed = False db_table = 'alembic_version' class Field(models.Model): id = models.AutoField(primary_key=True) name = models.TextField(blank=True, null=True) class Meta: db_table = 'field' def __str__(self): return self.name def dict(self): return {'id': self.id, 'name': self.name} class FieldsPeople(models.Model): id = models.AutoField(primary_key=True) person = models.ForeignKey('Person', models.DO_NOTHING, blank=True, null=True) field = models.ForeignKey(Field, models.DO_NOTHING, blank=True, null=True) class Meta: db_table = 'fields_people' class Method(models.Model): id = models.AutoField(primary_key=True) name = models.TextField(blank=True, null=True) class Meta: db_table = 'method' def __str__(self): return self.name def dict(self): return {'id': self.id, 'name': self.name} class MethodsPeople(models.Model): id = models.AutoField(primary_key=True) person = models.ForeignKey('Person', models.DO_NOTHING, blank=True, null=True) method = models.ForeignKey(Method, models.DO_NOTHING, blank=True, null=True) class Meta: db_table = 'methods_people' class Range(models.Model): id = models.AutoField(primary_key=True) source_id = models.IntegerField(blank=True, null=True) gmba_id = models.TextField(blank=True, null=True) 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_language = models.TextField(blank=True, null=True) mother_range = models.TextField(blank=True, null=True) feature = models.TextField(blank=True, null=True) map_unit = models.TextField(blank=True, null=True) level = models.TextField(blank=True, null=True) level_text = models.TextField(blank=True, null=True) 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) orogeny = models.TextField(blank=True, null=True) area = models.TextField(blank=True, null=True) GMBA_v1_id = models.TextField(blank=True, null=True) peak_elevation = models.TextField(blank=True, null=True) peak_name = models.TextField(blank=True, null=True) peak_latitude = models.TextField(blank=True, null=True) peak_longitude = models.TextField(blank=True, null=True) comments = models.TextField(blank=True, null=True) checked = models.TextField(blank=True, null=True) 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, unique=True) gmba_v2_id_str = models.TextField(blank=True, null=True) wiki_data_id = models.TextField(blank=True, null=True) 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) perimeter = models.TextField(blank=True, null=True) color_all = models.TextField(blank=True, null=True) color_basic = models.TextField(blank=True, null=True) color_300 = models.TextField(blank=True, null=True) elev_low = models.TextField(blank=True, null=True) elev_high = models.TextField(blank=True, null=True) elev_range = models.TextField(blank=True, null=True) elev_avg = models.TextField(blank=True, null=True) class Meta: db_table = 'range' def __str__(self): return self.name def dict(self): return { 'id': self.id, 'name': self.name, 'gmba_id': self.gmba_id, 'countries': self.countries, } class Resource(models.Model): id = models.AutoField(primary_key=True) source_id = models.IntegerField(blank=True, null=True) title = models.TextField(blank=True, null=True) url = models.TextField(blank=True, null=True) citation = models.TextField(blank=True, null=True) abstract = models.TextField(blank=True, null=True) type = models.TextField(blank=True, null=True) author_keywords = models.TextField(blank=True, null=True) lat = models.TextField(blank=True, null=True) lon = models.TextField(blank=True, null=True) stars = models.TextField(blank=True, null=True) PEGASuS_Check_map_with_author = models.TextField(blank=True, null=True) PEGASuS_polygon_ID = models.TextField(blank=True, null=True) PEGASuS_Polygon_comments = models.TextField(blank=True, null=True) PEGASuS_Assessment_ID = models.TextField(blank=True, null=True) gloria = models.TextField(blank=True, null=True) gnomo = models.TextField(blank=True, null=True) lter = models.TextField(blank=True, null=True) ltser = models.TextField(blank=True, null=True) miren = models.TextField(blank=True, null=True) team = models.TextField(blank=True, null=True) inventory = models.TextField(blank=True, null=True) doi = models.TextField(blank=True, null=True) WikiDataID = models.TextField(blank=True, null=True) class Meta: db_table = 'resource' def __str__(self): return self.title def dict(self): return { 'id': self.id, 'title': self.title or '', 'citation': self.citation or '', 'url': self.url or '', 'abstract': self.abstract or '', } class Scale(models.Model): id = models.AutoField(primary_key=True) name = models.TextField(blank=True, null=True) class Meta: db_table = 'scale' def __str__(self): return self.name class Taxon(models.Model): id = models.AutoField(primary_key=True) name = models.TextField(blank=True, null=True) class Meta: db_table = 'taxon' def __str__(self): return self.name def dict(self): return {'id': self.id, 'name': self.name} # LU models class Country(models.Model): id = models.AutoField(primary_key=True) short_name = models.TextField(blank=True, null=True) formal_name = models.TextField(blank=True, null=True) membership_within_un_system = models.TextField(blank=True, null=True) continent = models.TextField(blank=True, null=True) eu_ms = models.TextField(blank=True, null=True) eea_ms = models.TextField(blank=True, null=True) iso3 = models.TextField(blank=True, null=True) iso2 = models.TextField(blank=True, null=True) def __str__(self): return self.formal_name class GMBA_SpeciesGroup(models.Model): id = models.AutoField(primary_key=True) species_group = models.TextField(blank=True, null=True) class Language(models.Model): id = models.AutoField(primary_key=True) language = models.TextField(blank=True, null=True) class PeopleStatus(models.Model): id = models.AutoField(primary_key=True) status = models.TextField(blank=True, null=True) class RangeType(models.Model): id = models.AutoField(primary_key=True) range_type = models.TextField(blank=True, null=True) class RedListCategory(models.Model): id = models.AutoField(primary_key=True) red_list_category = models.TextField(blank=True, null=True) class TaxonStatus(models.Model): id = models.AutoField(primary_key=True) taxon_status = models.TextField(blank=True, null=True) class TaxonUnit(models.Model): id = models.AutoField(primary_key=True) taxon_unit = models.TextField(blank=True, null=True) class TrendsQuality(models.Model): id = models.AutoField(primary_key=True) trend = models.TextField(blank=True, null=True) class TrendsQuantity(models.Model): id = models.AutoField(primary_key=True) trend = models.TextField(blank=True, null=True) class Source(models.Model): id = models.AutoField(primary_key=True) source = models.TextField(blank=True, null=True) class Repository(models.Model): id = models.AutoField(primary_key=True) repository_name = models.TextField(blank=True, null=True) repository_url = models.TextField(blank=True, null=True) class GMBA_function(models.Model): id = models.AutoField(primary_key=True) gmba_function = models.TextField(blank=True, null=True) class Organization(models.Model): org_num1 = models.AutoField(primary_key=True) organisation_search = models.TextField(blank=True, null=True) org_alpha_search = models.TextField(blank=True, null=True) organisation_english = models.TextField(blank=True, null=True) organisation_2 = models.TextField(blank=True, null=True) organisation_3 = models.TextField(blank=True, null=True) organisation_original = models.TextField(blank=True, null=True) acronym = models.TextField(blank=True, null=True) street = models.TextField(blank=True, null=True) po_box = models.TextField(blank=True, null=True) postcode = models.TextField(blank=True, null=True) city = models.TextField(blank=True, null=True) region = models.TextField(blank=True, null=True) search_url = models.TextField(blank=True, null=True) lat_long = models.TextField(blank=True, null=True) url = models.TextField(blank=True, null=True) tel = models.TextField(blank=True, null=True) email = models.TextField(blank=True, null=True) country = models.TextField(blank=True, null=True) tags = models.TextField(blank=True, null=True) description = models.TextField(blank=True, null=True) northing = models.TextField(blank=True, null=True) easting = models.TextField(blank=True, null=True) category = models.TextField(blank=True, null=True) subject = models.TextField(blank=True, null=True) 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') info_source = models.TextField(blank=True, null=True) url = models.TextField(blank=True, null=True) class RangeNameTranslation(models.Model): id = models.AutoField(primary_key=True) range_name = models.ForeignKey(Range, 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) class AddElevation(models.Model): id = models.AutoField(primary_key=True) gmba_v2_id = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True, to_field='gmba_v2_id') elev_min = models.TextField(blank=True, null=True) elev_max = models.TextField(blank=True, null=True) elev_range = models.TextField(blank=True, null=True) class GMBA_V2_Centroid(models.Model): id = models.AutoField(primary_key=True) gridcode = models.TextField(blank=True, null=True) area = models.TextField(blank=True, null=True) latitude = models.TextField(blank=True, null=True) longitude = models.TextField(blank=True, null=True) class ImportGeom210915(models.Model): id = models.AutoField(primary_key=True) gmba_v2_id = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True, to_field='gmba_v2_id') area = models.TextField(blank=True, null=True) perimeter = models.TextField(blank=True, null=True) color_all = models.TextField(blank=True, null=True) color_basic = models.TextField(blank=True, null=True) class Keyword(models.Model): keyword_id = models.AutoField(primary_key=True) mother = models.TextField(blank=True, null=True) keyword = models.TextField(blank=True, null=True) class ResourceKeyword(models.Model): id = models.AutoField(primary_key=True) resource = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True) keyword = models.ForeignKey(Keyword, models.DO_NOTHING, blank=True, null=True, to_field='keyword_id') class NamesImport(models.Model): id = models.AutoField(primary_key=True) gmba_v2_id = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True, to_field='gmba_v2_id') cn = models.TextField(blank=True, null=True) de = models.TextField(blank=True, null=True) es = models.TextField(blank=True, null=True) fr = models.TextField(blank=True, null=True) pt = models.TextField(blank=True, null=True) ru = models.TextField(blank=True, null=True) tr = models.TextField(blank=True, null=True) 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) class LanguageLink(models.Model): id = models.AutoField(primary_key=True) language_number_code = models.ForeignKey(Language, models.DO_NOTHING, blank=True, null=True) language_letter_code = models.TextField(blank=True, null=True) class Peak(models.Model): id = models.AutoField(primary_key=True) point_name = models.TextField(blank=True, null=True) latitude = models.TextField(blank=True, null=True) longitude = models.TextField(blank=True, null=True) type = models.TextField(blank=True, null=True) elevation = models.TextField(blank=True, null=True) link = models.TextField(blank=True, null=True) class Search(models.Model): id = models.AutoField(primary_key=True) range_name = models.ForeignKey(Range, 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) result = models.TextField(blank=True, null=True) number_of_records = models.TextField(blank=True, null=True) stored = models.TextField(blank=True, null=True) class Person(models.Model): id = models.AutoField(primary_key=True) source_id = models.IntegerField(blank=True, null=True) title = models.TextField(blank=True, null=True) first_name = models.TextField(blank=True, null=True) last_name = models.TextField(blank=True, null=True) organisation = models.TextField(blank=True, null=True) position = models.TextField(blank=True, null=True) country = models.TextField(blank=True, null=True) contact_email = models.TextField(blank=True, null=True) # email_1 personal_url = models.TextField(blank=True, null=True) # url ? biography = models.TextField(blank=True, null=True) field_indexer = models.TextField(db_column='_indexer', blank=True, null=True) # Field renamed because it started with '_'. mr_mrs = models.TextField(blank=True, null=True) full_name = models.TextField(blank=True, null=True) search_name = models.TextField(blank=True, null=True) email_2 = models.TextField(blank=True, null=True) skype = models.TextField(blank=True, null=True) professional_phone = models.TextField(blank=True, null=True) mobile_number = models.TextField(blank=True, null=True) url = models.TextField(blank=True, null=True) field_of_expertise = models.TextField(blank=True, null=True) status = models.TextField(blank=True, null=True) entry_date = models.TextField(blank=True, null=True) gmba_function = models.TextField(blank=True, null=True) news_letter = models.TextField(blank=True, null=True) organization = models.ForeignKey(Organization, models.DO_NOTHING, blank=True, null=True) birds = models.TextField(blank=True, null=True) mammals = models.TextField(blank=True, null=True) reptiles = models.TextField(blank=True, null=True) amphibians = models.TextField(blank=True, null=True) fish = models.TextField(blank=True, null=True) insects = models.TextField(blank=True, null=True) molluscs = models.TextField(blank=True, null=True) crustaceans = models.TextField(blank=True, null=True) arachnids = models.TextField(blank=True, null=True) angiosperms = models.TextField(blank=True, null=True) gymnosperms = models.TextField(blank=True, null=True) fungi = models.TextField(blank=True, null=True) algae = models.TextField(blank=True, null=True) biological_field_sampling = models.TextField(blank=True, null=True) data_mining = models.TextField(blank=True, null=True) remote_sensing = models.TextField(blank=True, null=True) gis = models.TextField(blank=True, null=True) spatial_analysis = models.TextField(blank=True, null=True) statistical_analysis = models.TextField(blank=True, null=True) modelling = models.TextField(blank=True, null=True) assessment = models.TextField(blank=True, null=True) meta_analysis = models.TextField(blank=True, null=True) synthesis = models.TextField(blank=True, null=True) qualitative_ssm = models.TextField(blank=True, null=True) #"Qualitative social science methods (interviews, surveys)" genetic_analyses = models.TextField(blank=True, null=True) field_site = models.TextField(blank=True, null=True) transect = models.TextField(blank=True, null=True) mountain_top = models.TextField(blank=True, null=True) mountain_range = models.TextField(blank=True, null=True) landscape = models.TextField(blank=True, null=True) regional = models.TextField(blank=True, null=True) national = models.TextField(blank=True, null=True) _global = models.TextField(blank=True, null=True) geographic_area_of_expertise = models.TextField(blank=True, null=True) profile_on_web = models.TextField(blank=True, null=True) updated = models.TextField(blank=True, null=True) orcid = models.TextField(blank=True, null=True) web_of_science = models.TextField(blank=True, null=True) twitter = models.TextField(blank=True, null=True) instagram = models.TextField(blank=True, null=True) class Meta: db_table = 'person' def index(self): self.field_indexer = " ".join([ self.first_name, self.last_name, self.organisation, self.position, self.biography ]) return True def fullname(self): return " ".join([self.title, self.first_name, self.last_name]) def __str__(self): return self.fullname() def dict(self): return { 'id': self.id, 'fullname': self.fullname(), 'organisation': self.organisation or '', 'position': self.position or '', 'country': self.country or '', 'personal_url': self.personal_url or '', 'personal_urls': self.personal_url.split(';'), 'biography': self.biography or '', } class TaxaPeople(models.Model): id = models.AutoField(primary_key=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) taxon = models.ForeignKey('Taxon', models.DO_NOTHING, blank=True, null=True) class Meta: db_table = 'taxa_people' 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) class Meta: db_table = 'ranges_people' class ResourcesPeople(models.Model): id = models.AutoField(primary_key=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) resource = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True) class Meta: db_table = 'resources_people' class ScalesPeople(models.Model): id = models.AutoField(primary_key=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) scale = models.ForeignKey(Scale, models.DO_NOTHING, blank=True, null=True) class Meta: db_table = 'scales_people' class Species(models.Model): id = models.AutoField(primary_key=True) scientific_name = models.TextField(blank=True, null=True) _class = models.TextField(blank=True, null=True) english_name = models.TextField(blank=True, null=True) url = models.TextField(blank=True, null=True) class PeopleFunction(models.Model): id = models.AutoField(primary_key=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) scale = models.ForeignKey(GMBA_function, models.DO_NOTHING, blank=True, null=True) 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) endemic = models.TextField(blank=True, null=True) source_url = models.TextField(blank=True, null=True) 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) class TaxonRange(models.Model): id = models.AutoField(primary_key=True) range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) taxon = models.ForeignKey(Taxon, models.DO_NOTHING, blank=True, null=True) subrange_or_region = models.TextField(blank=True, null=True) taxon_status = models.TextField(blank=True, null=True) distribution = models.TextField(blank=True, null=True) redlist = models.TextField(blank=True, null=True) count_unit = models.TextField(blank=True, null=True) number_of_units = models.TextField(blank=True, null=True) source = models.TextField(blank=True, null=True) remarks = models.TextField(blank=True, null=True) class PeopleResource(models.Model): id = models.AutoField(primary_key=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) resource = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True) role = models.TextField(blank=True, null=True) class RangeCountry(models.Model): id = models.AutoField(primary_key=True) range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) country = models.ForeignKey(Country, models.DO_NOTHING, blank=True, null=True)