diff --git a/app/admin.py b/app/admin.py index 5463185..fa1a745 100644 --- a/app/admin.py +++ b/app/admin.py @@ -79,6 +79,27 @@ class RangeOnlineInfoAdmin(admin.ModelAdmin): search_fields = ['info_source'] +class PeaksAdmin(admin.ModelAdmin): + search_fields = ['point_name', 'link'] + + +class SearchAdmin(admin.ModelAdmin): + search_fields = ['search_string', 'search_date', 'result'] + + +class SpeciesAdmin(admin.ModelAdmin): + search_fields = ['scientific_name', 'class_', 'english_name', 'url'] + + +class TaxonRangeAdmin(admin.ModelAdmin): + search_fields = ['subrange_or_region', 'distribution', 'source', 'remarks'] + + +class RangeNameTranslationAdmin(admin.ModelAdmin): + search_fields = ['range_name_translation'] + + + # Register your models here. admin.site.register(Person, PersonAdmin) admin.site.register(Resource, ResourceAdmin) @@ -101,7 +122,27 @@ admin.site.register(TaxonStatus, TaxonStatusAdmin) admin.site.register(TaxonUnit, TaxonUnitAdmin) admin.site.register(TrendsQuality, TrendsQualityAdmin) admin.site.register(TrendsQuantity, TrendsQuantityAdmin) + +# Others admin.site.register(Repository, RepositoryAdmin) admin.site.register(GMBA_function, GMBAFunctionAdmin) admin.site.register(Organization, OrganizationAdmin) admin.site.register(RangeOnlineInfo, RangeOnlineInfoAdmin) + +admin.site.register(RangeNameTranslation, RangeNameTranslationAdmin) +admin.site.register(AddElevation) +admin.site.register(GMBA_V2_Centroid) +admin.site.register(ImportGeom210915) +admin.site.register(Peak, PeaksAdmin) +admin.site.register(Search, SearchAdmin) +admin.site.register(TaxaPeople) +admin.site.register(RangesPeople) +admin.site.register(ResourcesPeople) +admin.site.register(ScalesPeople) +admin.site.register(Species, SpeciesAdmin) +admin.site.register(PeopleFunction) +admin.site.register(SpeciesRange) +admin.site.register(PeopleRange) +admin.site.register(TaxonRange, TaxonRangeAdmin) +admin.site.register(PeopleResource) +admin.site.register(RangeCountry) diff --git a/app/models.py b/app/models.py index 567febb..a9c6e77 100644 --- a/app/models.py +++ b/app/models.py @@ -60,48 +60,6 @@ class MethodsPeople(models.Model): db_table = 'methods_people' -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) - personal_url = models.TextField(blank=True, null=True) - biography = models.TextField(blank=True, null=True) - field_indexer = models.TextField(db_column='_indexer', blank=True, null=True) # Field renamed because it started with '_'. - - 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 Range(models.Model): id = models.AutoField(primary_key=True) source_id = models.IntegerField(blank=True, null=True) @@ -172,15 +130,6 @@ class Range(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) - - class Meta: - db_table = 'ranges_people' - - class Resource(models.Model): id = models.AutoField(primary_key=True) source_id = models.IntegerField(blank=True, null=True) @@ -189,7 +138,6 @@ class Resource(models.Model): citation = models.TextField(blank=True, null=True) abstract = models.TextField(blank=True, null=True) - citation = 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) @@ -225,15 +173,6 @@ class Resource(models.Model): } -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 Scale(models.Model): id = models.AutoField(primary_key=True) name = models.TextField(blank=True, null=True) @@ -245,24 +184,6 @@ class Scale(models.Model): return self.name -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 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 Taxon(models.Model): id = models.AutoField(primary_key=True) name = models.TextField(blank=True, null=True) @@ -337,11 +258,6 @@ class TrendsQuantity(models.Model): trend = models.TextField(blank=True, null=True) -class Language(models.Model): - id = models.AutoField(primary_key=True) - language = models.TextField(blank=True, null=True) - - class Source(models.Model): id = models.AutoField(primary_key=True) source = models.TextField(blank=True, null=True) @@ -451,7 +367,7 @@ class NamesImport(models.Model): class ResourceRange(models.Model): id = models.AutoField(primary_key=True) - resource_title = models.ForeignKey(Range, 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) @@ -461,7 +377,210 @@ class LanguageLink(models.Model): language_letter_code = models.TextField(blank=True, null=True) -class ImportGeom210915(models.Model): +class Peak(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) \ No newline at end of file + 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)