Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
App Kit Taxonomy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Local Cosmos
App Kit Taxonomy
Commits
09b04e84
Commit
09b04e84
authored
3 years ago
by
Thomas Uher
Browse files
Options
Downloads
Patches
Plain Diff
update all_vernacular_names
parent
334dc568
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lazy.py
+22
-16
22 additions, 16 deletions
lazy.py
with
22 additions
and
16 deletions
lazy.py
+
22
−
16
View file @
09b04e84
...
...
@@ -100,29 +100,35 @@ class LazyTaxon(LazyTaxonBase):
return
None
def
all_vernacular_names
(
self
,
only_preferred
=
True
,
cache
=
None
):
def
all_vernacular_names
(
self
,
only_preferred
=
True
,
cache
=
None
,
language
=
None
):
matches
=
[]
found_locales
=
[]
locales
=
MetaVernacularNames
.
objects
.
filter
(
taxon_latname
=
self
.
taxon_latname
,
taxon_author
=
self
.
taxon_author
)
if
only_preferred
:
locales
=
locales
.
filter
(
preferred
=
True
)
if
not
language
:
found_locales
=
[]
locales
=
MetaVernacularNames
.
objects
.
filter
(
taxon_latname
=
self
.
taxon_latname
,
taxon_author
=
self
.
taxon_author
)
if
only_preferred
:
locales
=
locales
.
filter
(
preferred
=
True
)
for
locale
in
locales
:
matches
.
append
(
locale
)
found_locales
.
append
(
locale
.
language
)
for
locale
in
locales
:
matches
.
append
(
locale
)
found_locales
.
append
(
locale
.
language
)
locales
=
self
.
models
.
TaxonLocaleModel
.
objects
.
filter
(
taxon__taxon_latname
=
self
.
taxon_latname
,
taxon__taxon_author
=
self
.
taxon_author
).
exclude
(
language__in
=
found_locales
)
locales
=
self
.
models
.
TaxonLocaleModel
.
objects
.
filter
(
taxon__taxon_latname
=
self
.
taxon_latname
,
taxon__taxon_author
=
self
.
taxon_author
).
exclude
(
language__in
=
found_locales
)
#if only_preferred:
# locales = locales.filter(preferred=True)
#if only_preferred:
# locales = locales.filter(preferred=True)
for
locale
in
locales
:
matches
.
append
(
locale
)
for
locale
in
locales
:
matches
.
append
(
locale
)
else
:
matches
=
self
.
models
.
TaxonLocaleModel
.
objects
.
filter
(
taxon__taxon_latname
=
self
.
taxon_latname
,
taxon__taxon_author
=
self
.
taxon_author
,
language
=
language
)
return
matches
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment