# 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 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) gmba_id = models.TextField(blank=True, null=True) name = models.TextField(blank=True, null=True) countries = 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 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) 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) 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 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) class Meta: db_table = 'scale' 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) class Meta: db_table = 'taxon' def __str__(self): return self.name def dict(self): return {'id': self.id, 'name': self.name}