From 2935a6facad4f81ab56a2f2876cdaafe35b820ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20M=C3=A9nager?= <herve.menager@pasteur.fr> Date: Fri, 26 Jun 2020 14:58:17 +0200 Subject: [PATCH] add Cytotoxicity and PK test results to contribution view WIP on #224 --- ippisite/ippidb/models.py | 8 ++++++++ .../ippidb/testcytotoxdescription_card.html | 14 +++++++++++++ .../ippidb/testpkdescription_card.html | 20 +++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index 2c08a222..66dcac11 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -1319,6 +1319,10 @@ class CompoundCytotoxicityResult(models.Model): self.test_cytotoxicity_description.id, self.compound.id ) + @property + def ref(self): + return RefCompoundBiblio.objects.get(compound=self.compound, bibliography=self.test_cytotoxicity_description.biblio) + class TestPKDescription(models.Model): """ @@ -1378,6 +1382,10 @@ class CompoundPKResult(models.Model): self.test_pk_description.id, self.compound.id ) + @property + def ref(self): + return RefCompoundBiblio.objects.get(compound=self.compound, bibliography=self.test_pk_description.biblio) + class CompoundAction(models.Model): """ diff --git a/ippisite/ippidb/templates/ippidb/testcytotoxdescription_card.html b/ippisite/ippidb/templates/ippidb/testcytotoxdescription_card.html index 599cac2b..8fd985f5 100644 --- a/ippisite/ippidb/templates/ippidb/testcytotoxdescription_card.html +++ b/ippisite/ippidb/templates/ippidb/testcytotoxdescription_card.html @@ -12,5 +12,19 @@ <span style="font-family: BrandonGrotesqueBld;">{{object|verbose_name:'cell_line'}}: </span>{{object.cell_line}} </div> </div> + + <table class="table"> + <tr> + <th>Compound</th> + <th>Toxicity</th> + </tr> + {% for result in object.compoundcytotoxicityresult_set.all %} + <tr> + <td>{{result.ref.compound_name}}</td> + <td>{{result.toxicity}}</td> + </tr> + {% endfor %} + </table> + </div> {%endif%} \ No newline at end of file diff --git a/ippisite/ippidb/templates/ippidb/testpkdescription_card.html b/ippisite/ippidb/templates/ippidb/testpkdescription_card.html index bf8d6f5c..477bb940 100644 --- a/ippisite/ippidb/templates/ippidb/testpkdescription_card.html +++ b/ippisite/ippidb/templates/ippidb/testpkdescription_card.html @@ -26,5 +26,25 @@ </span>{{object.dose_interval}} </div> </div> + + <table class="table"> + <tr> + {% with result=object.compoundpkresult_set.first %} + <th>Compound</th> + <th>{{result|verbose_name:'tolerated'}}</th> + <th>{{result|verbose_name:'t_demi'}} / {{result|verbose_name:'t_max'}}</th> + <th>{{result|verbose_name:'auc_av'}} / {{result|verbose_name:'clearance_av'}} / {{result|verbose_name:'c_max_av'}} / {{result|verbose_name:'voldistribution_av'}}</th> + {% endwith %} + </tr> + {% for result in object.compoundpkresult_set.all %} + <tr> + <td>{{result.ref.compound_name}}</td> + <td>{{result.tolerated}}</td> + <td>{{result.t_demi}} / {{result.t_max}}</td> + <td>{{result.auc_av}} / {{result.clearance_av}} / {{result.c_max_av}} / {{result.voldistribution_av}}</td> + </tr> + {% endfor %} + </table> + </div> {%endif%} \ No newline at end of file -- GitLab