Commit fa199d97 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

Merge branch 'master' into 'release'

prepare for v1.0.6

See merge request !24
parents 7061ae60 8e85d2bb
Pipeline #44007 passed with stages
in 12 minutes and 28 seconds
......@@ -1150,6 +1150,21 @@ class Compound(AutoFillableModel):
else None
)
@property
def sameas_urls(self):
urls = []
if self.pubchem_id:
urls.append(self.pubchem_url)
if self.chembl_id:
urls.append(self.chembl_url)
if self.chemspider_id:
urls.append(self.chemspider_url)
if self.ligand_id:
urls.append(self.pdbligand_url)
if self.drugbank_id:
urls.append(self.drugbank_url)
return urls
def clean(self):
"""
Perform additional checks:
......
......@@ -572,20 +572,8 @@
"smiles": [
"{{ compound.canonical_smile }}"
],
{% if compound.pubchem_id %}
"sameAs": "{{ compound.pubchem_url }}",
{% endif %}
{% if compound.chembl_id %}
"sameAs": "{{ compound.chembl_url }}",
{% endif %}
{% if compound.chemspider_id %}
"sameAs": "{{ compound.chemspider_url }}",
{% endif %}
{% if compound.ligand_id %}
"sameAs": "{{ compound.pdbligand_url }}",
{% endif %}
{% if compound.drugbank_id %}
"sameAs": "{{ compound.drugbank_url }}",
{% if compound.sameas_urls %}
"sameAs": {{ compound.sameas_urls|safe }},
{% endif %}
"@context": "http://schema.org"
}
......
Markdown is supported
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