Commit a7fac32b authored by Thomas Uher's avatar Thomas Uher
Browse files

support for TaxonNamesModel

parent 6c8b9349
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -23,7 +23,7 @@ class LazyTaxon(LazyTaxonBase):
'''
the tree instance can be none, if the taxon does not exist anymore in the tree
- do NOT query by name_uuid, which might change across tree updates
- preferrably do NOT query by name_uuid
- DO query taxon_latname AND taxon_author
'''
def tree_instance(self):
......@@ -57,6 +57,7 @@ class LazyTaxon(LazyTaxonBase):
if instance:
return True
return False
def synonym_instance(self):
query = self.models.TaxonSynonymModel.objects.filter(taxon_latname=self.taxon_latname,
......@@ -72,7 +73,20 @@ class LazyTaxon(LazyTaxonBase):
return instance
return None
def preferred_name_lazy_taxon(self):
synonym_instance = self.synonym_instance()
tree_instance = self.tree_instance()
if tree_instance:
return self
elif synonym_instance:
lazy_taxon = LazyTaxon(instance=synonym_instance.taxon)
return lazy_taxon
return None
def vernacular(self, language=None, cache=None):
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
# Generated by Django 3.1.14 on 2022-05-03 07:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('taxonomy', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='metavernacularnames',
name='taxon_source',
field=models.CharField(choices=[('taxonomy.sources.col', 'Catalogue Of Life 2019'), ('taxonomy.sources.algaebase', 'AlgaeBase 2020'), ('taxonomy.sources.custom', 'Custom Taxa')], max_length=255),
),
]
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment