Skip to content

Commit

Permalink
separate reaction equation from __str__
Browse files Browse the repository at this point in the history
  • Loading branch information
kiancm committed Dec 22, 2020
1 parent a946269 commit 99c0e36
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions database/models/reaction_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ def kinetics_count(self):
return Kinetics.objects.filter(reaction=self).count()

def __str__(self):
return f"{self.id} {self.equation}"

@property
def equation(self):
stoich_reactants = []
stoich_products = []
for stoich, species in self.stoich_species():
Expand Down
2 changes: 1 addition & 1 deletion database/templates/database/kineticmodel_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h2>Reactions</h2>
<div class="card">
<a href="{% url 'reaction-detail' kinetics.reaction.pk %}" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ kinetics.reaction }}</h5>
<h5 class="mb-1">{{ kinetics.reaction.equation }}</h5>
<small>ID: {{ kinetics.reaction.pk }}</small>
</div>
{% if kinetics.reaction.prime_id %}<p>PrIMe ID: {{kinetics.reaction.prime_id}}</p>{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion database/templates/database/kinetics_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% block content %}
<h1>
<a href="{% url 'reaction-detail' kinetics.reaction.pk %}">{{ kinetics.reaction }} </a> |
<a href="{% url 'reaction-detail' kinetics.reaction.pk %}">{{ kinetics.reaction.equation }} </a> |
<a href="{% url 'source-detail' kinetics.source.pk %}">{{ kinetics.source.name }}</a>
</h1>
<br>
Expand Down
2 changes: 1 addition & 1 deletion database/templates/database/reaction_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load utils %}

{% block content %}
<h2>{{reaction}}</h2>
<h2>{{ reaction.equation }}</h2>
<h2>ID: {{ reaction.pk }}</h2>
<br>
<h3>Reactants</h3>
Expand Down
2 changes: 1 addition & 1 deletion database/templates/database/reaction_filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1>Reaction</h1>
class="list-group-item list-group-item-action flex-column align-items-start"
>
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ reaction }}</h5>
<h5 class="mb-1">{{ reaction.equation }}</h5>
<small>ID: {{ reaction.pk }}</small>
</div>
{% if reaction.prime_id %}
Expand Down

0 comments on commit 99c0e36

Please sign in to comment.