2021-07-27 04:00:24 +00:00
|
|
|
# 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):
|
2021-07-27 04:18:28 +00:00
|
|
|
version_num = models.TextField()
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
managed = False
|
|
|
|
db_table = 'alembic_version'
|
|
|
|
|
|
|
|
|
|
|
|
class Field(models.Model):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:18:28 +00:00
|
|
|
name = models.TextField(blank=True, null=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
db_table = 'field'
|
|
|
|
|
2021-07-28 04:12:29 +00:00
|
|
|
def __str__(self): return self.name
|
2021-07-27 04:51:02 +00:00
|
|
|
|
|
|
|
def dict(self):
|
|
|
|
return {'id': self.id, 'name': self.name}
|
|
|
|
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class FieldsPeople(models.Model):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
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):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:18:28 +00:00
|
|
|
name = models.TextField(blank=True, null=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
db_table = 'method'
|
|
|
|
|
2021-07-28 04:12:29 +00:00
|
|
|
def __str__(self): return self.name
|
2021-07-27 04:51:02 +00:00
|
|
|
|
|
|
|
def dict(self):
|
|
|
|
return {'id': self.id, 'name': self.name}
|
|
|
|
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class MethodsPeople(models.Model):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
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):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
source_id = models.IntegerField(blank=True, null=True)
|
2021-07-27 04:18:28 +00:00
|
|
|
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)
|
2021-07-27 04:00:24 +00:00
|
|
|
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'
|
|
|
|
|
2021-07-27 04:51:02 +00:00
|
|
|
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])
|
|
|
|
|
2021-07-28 04:12:29 +00:00
|
|
|
def __str__(self):
|
2021-07-27 04:51:02 +00:00
|
|
|
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 '',
|
|
|
|
}
|
|
|
|
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class Range(models.Model):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
source_id = models.IntegerField(blank=True, null=True)
|
2021-07-27 04:18:28 +00:00
|
|
|
gmba_id = models.TextField(blank=True, null=True)
|
|
|
|
name = models.TextField(blank=True, null=True)
|
|
|
|
countries = models.TextField(blank=True, null=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
db_table = 'range'
|
|
|
|
|
2021-07-28 04:12:29 +00:00
|
|
|
def __str__(self):
|
2021-07-27 04:51:02 +00:00
|
|
|
return self.name
|
|
|
|
|
|
|
|
def dict(self):
|
|
|
|
return {
|
|
|
|
'id': self.id,
|
|
|
|
'name': self.name,
|
|
|
|
'gmba_id': self.gmba_id,
|
|
|
|
'countries': self.countries,
|
|
|
|
}
|
|
|
|
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class RangesPeople(models.Model):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
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):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
source_id = models.IntegerField(blank=True, null=True)
|
2021-07-27 04:18:28 +00:00
|
|
|
title = models.TextField(blank=True, null=True)
|
|
|
|
url = models.TextField(blank=True, null=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
citation = models.TextField(blank=True, null=True)
|
|
|
|
abstract = models.TextField(blank=True, null=True)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
db_table = 'resource'
|
|
|
|
|
2021-07-28 04:12:29 +00:00
|
|
|
def __str__(self):
|
2021-07-27 04:51:02 +00:00
|
|
|
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 '',
|
|
|
|
}
|
|
|
|
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class ResourcesPeople(models.Model):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
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):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:18:28 +00:00
|
|
|
name = models.TextField(blank=True, null=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
db_table = 'scale'
|
|
|
|
|
2021-10-11 03:03:49 +00:00
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class ScalesPeople(models.Model):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
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):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
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):
|
2021-07-27 04:08:39 +00:00
|
|
|
id = models.AutoField(primary_key=True)
|
2021-07-27 04:18:28 +00:00
|
|
|
name = models.TextField(blank=True, null=True)
|
2021-07-27 04:00:24 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
db_table = 'taxon'
|
2021-07-27 04:51:02 +00:00
|
|
|
|
2021-07-28 04:12:29 +00:00
|
|
|
def __str__(self): return self.name
|
2021-07-27 04:51:02 +00:00
|
|
|
|
|
|
|
def dict(self):
|
|
|
|
return {'id': self.id, 'name': self.name}
|
2021-10-29 02:33:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
# 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 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)
|