Add str repr
This commit is contained in:
parent
30b8e6c397
commit
aa65b9c9cd
1 changed files with 109 additions and 1 deletions
110
app/models.py
110
app/models.py
|
@ -217,62 +217,98 @@ class GMBA_SpeciesGroup(models.Model):
|
|||
id = models.AutoField(primary_key=True)
|
||||
species_group = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.species_group
|
||||
|
||||
|
||||
class Language(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
language = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.language
|
||||
|
||||
|
||||
class PeopleStatus(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
status = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.status
|
||||
|
||||
|
||||
class RangeType(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
range_type = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.range_type
|
||||
|
||||
|
||||
class RedListCategory(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
red_list_category = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.red_list_category
|
||||
|
||||
|
||||
class TaxonStatus(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
taxon_status = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.taxon_status
|
||||
|
||||
|
||||
class TaxonUnit(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
taxon_unit = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.taxon_unit
|
||||
|
||||
|
||||
class TrendsQuality(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
trend = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.trend
|
||||
|
||||
|
||||
class TrendsQuantity(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
trend = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.trend
|
||||
|
||||
|
||||
class Source(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
source = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.source
|
||||
|
||||
|
||||
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)
|
||||
|
||||
def __str__(self):
|
||||
return '%s --- %s' % (self.repository_name, self.repository_url)
|
||||
|
||||
|
||||
class GMBA_function(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
gmba_function = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.gmba_function
|
||||
|
||||
|
||||
class Organization(models.Model):
|
||||
org_num1 = models.AutoField(primary_key=True)
|
||||
|
@ -301,6 +337,9 @@ class Organization(models.Model):
|
|||
category = models.TextField(blank=True, null=True)
|
||||
subject = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.organisation_english
|
||||
|
||||
|
||||
class RangeOnlineInfo(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -308,6 +347,9 @@ class RangeOnlineInfo(models.Model):
|
|||
info_source = models.TextField(blank=True, null=True)
|
||||
url = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.range_name
|
||||
|
||||
|
||||
class RangeNameTranslation(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -315,6 +357,9 @@ class RangeNameTranslation(models.Model):
|
|||
language_translation = models.ForeignKey(Language, models.DO_NOTHING, blank=True, null=True)
|
||||
range_name_translation = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s' % (self.range_name, self.language_translation.language)
|
||||
|
||||
|
||||
class AddElevation(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -322,6 +367,9 @@ class AddElevation(models.Model):
|
|||
elev_min = models.TextField(blank=True, null=True)
|
||||
elev_max = models.TextField(blank=True, null=True)
|
||||
elev_range = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s' % (self.gmba_v2_id, self.elev_range)
|
||||
|
||||
|
||||
class GMBA_V2_Centroid(models.Model):
|
||||
|
@ -331,6 +379,9 @@ class GMBA_V2_Centroid(models.Model):
|
|||
latitude = models.TextField(blank=True, null=True)
|
||||
longitude = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s, %s' % (self.gridcode, self.latitude, self.longitude)
|
||||
|
||||
|
||||
class ImportGeom210915(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -340,18 +391,27 @@ class ImportGeom210915(models.Model):
|
|||
color_all = models.TextField(blank=True, null=True)
|
||||
color_basic = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.gmba_v2_id
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s' % (self.keyword, self.mother)
|
||||
|
||||
|
||||
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')
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s' % (self.resource.title, self.keyword.keyword)
|
||||
|
||||
|
||||
class NamesImport(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -364,18 +424,27 @@ class NamesImport(models.Model):
|
|||
ru = models.TextField(blank=True, null=True)
|
||||
tr = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s - %s - %s' % (self.gmba_v2_id, self.cn, self.de, self.fr)
|
||||
|
||||
|
||||
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)
|
||||
|
||||
def __str__(self):
|
||||
return '%s, %s' % (self.resource_title.title, self.range_name.name)
|
||||
|
||||
|
||||
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)
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s' % (self.language_number_code.language, self.language_letter_code)
|
||||
|
||||
|
||||
class Peak(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -386,6 +455,9 @@ class Peak(models.Model):
|
|||
elevation = models.TextField(blank=True, null=True)
|
||||
link = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.point_name
|
||||
|
||||
|
||||
class Search(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -397,6 +469,9 @@ class Search(models.Model):
|
|||
number_of_records = models.TextField(blank=True, null=True)
|
||||
stored = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.range_name.name, self.repository
|
||||
|
||||
|
||||
class Person(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -505,6 +580,9 @@ class TaxaPeople(models.Model):
|
|||
class Meta:
|
||||
db_table = 'taxa_people'
|
||||
|
||||
def __str__(self):
|
||||
return self.person.full_name
|
||||
|
||||
|
||||
class RangesPeople(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -514,6 +592,9 @@ class RangesPeople(models.Model):
|
|||
class Meta:
|
||||
db_table = 'ranges_people'
|
||||
|
||||
def __str__(self):
|
||||
return self.person.full_name
|
||||
|
||||
|
||||
class ResourcesPeople(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -523,6 +604,9 @@ class ResourcesPeople(models.Model):
|
|||
class Meta:
|
||||
db_table = 'resources_people'
|
||||
|
||||
def __str__(self):
|
||||
return self.person.full_name
|
||||
|
||||
|
||||
class ScalesPeople(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -531,6 +615,9 @@ class ScalesPeople(models.Model):
|
|||
|
||||
class Meta:
|
||||
db_table = 'scales_people'
|
||||
|
||||
def __str__(self):
|
||||
return self.person.full_name
|
||||
|
||||
|
||||
class Species(models.Model):
|
||||
|
@ -540,12 +627,18 @@ class Species(models.Model):
|
|||
english_name = models.TextField(blank=True, null=True)
|
||||
url = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return '%s, %s, %s' % (self.scientific_name, self._class, self.english_name)
|
||||
|
||||
|
||||
class PeopleFunction(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
|
||||
function = models.ForeignKey(GMBA_function, models.DO_NOTHING, blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.person.full_name
|
||||
|
||||
|
||||
class SpeciesRange(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -554,12 +647,18 @@ class SpeciesRange(models.Model):
|
|||
endemic = models.TextField(blank=True, null=True)
|
||||
source_url = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.scientific_name.scientific_name
|
||||
|
||||
|
||||
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)
|
||||
|
||||
def __str__(self):
|
||||
return self.person.full_name
|
||||
|
||||
|
||||
class TaxonRange(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -574,6 +673,9 @@ class TaxonRange(models.Model):
|
|||
source = models.TextField(blank=True, null=True)
|
||||
remarks = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.range.name
|
||||
|
||||
|
||||
class PeopleResource(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
@ -581,8 +683,14 @@ class PeopleResource(models.Model):
|
|||
resource = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True)
|
||||
role = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.person.full_name
|
||||
|
||||
|
||||
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)
|
||||
|
||||
def __str__(self):
|
||||
return self.range.name
|
Loading…
Reference in a new issue