Compare commits

...

2 Commits

Author SHA1 Message Date
Chris GIACOFEI
f293e4ec7b Add Brewfather links to yeast pages if available. 2024-06-03 15:39:54 -04:00
Chris GIACOFEI
17d8eab873 Add properties to get Brewfather links data. 2024-06-03 15:38:38 -04:00
4 changed files with 40 additions and 15 deletions

View File

@ -110,7 +110,7 @@
<footer class="bg-body-tertiary text-center fixed-bottom">
<!-- Copyright -->
<div class="text-center p-1" style="background-color: rgba(0, 0, 0, 0.1);">
&copy; Damn yankee Brewing 2010-{% now "Y" %}
&copy; Damn Yankee Brewing 2010-{% now "Y" %}
</div>
<!-- Copyright -->
</footer>

View File

@ -10,6 +10,7 @@ from config.extras import DateUUIDField
import logging
logger = logging.getLogger('django')
from config.extras import BREWFATHER_APP_ROOT
class AvailableYeastManager(models.Manager):
""" Special manager for filtering out pitched yeast."""
@ -89,6 +90,21 @@ class Batch(CustomModel):
self.parent.add(sample)
@property
def beer_name(self):
if self.source_batch:
return self.source_batch.brewfather_name
@property
def beer_num(self):
if self.source_batch:
return self.source_batch.brewfather_num
@property
def beer_url(self):
if self.source_batch:
return '{}/tabs/batches/batch/{}'.format(BREWFATHER_APP_ROOT, self.source_batch.brewfather_id)
@property
def consumed(self):
return not len(self.remaining_samples) > 0

View File

@ -9,7 +9,11 @@
<div class="container">
<h1>{{ batch.strain.name }}</h1>
<b>Source: {{ batch.get_source_display }}</b>
<b>Source: {{ batch.get_source_display }}
{% if batch.source_batch %}
from <a href="{{ batch.beer_url }}" target="_blank" rel="noopener noreferrer">#{{ batch.beer_num }}: {{ batch.beer_name }}</a>
{% endif %}
</b>
<p><p>
</div> <!-- /container -->
@ -40,7 +44,7 @@
</fieldset>
</div>
<div class="col-md-6 form-group">
<legend>Print Labels for this Batch</legend>
<legend>Print Selected Labels for this Batch</legend>
<p><p>
<label for="skip_count">Number of labels already removed from the sheet: </label>
<input id="skip_count" type="number" name="skip_count" value=0 size="4">

View File

@ -3,27 +3,32 @@
{% block title %}Yeast Samples{% endblock %}
{% block jumbotron %}Yeast Sample:{% endblock %}
{% block jumbotronsub %}{{ sample.id }}{% endblock %}
{% block jumbotronsub %}<a href="{% url 'admin:yeast_yeast_change' sample.id %}">{{ sample.id }}</a>{% endblock %}
{% block content %}
<div class="container">
<h3>{{ batch.strain.name }}</h3>
Batch Source: {{ batch.get_source_display }}<br>
Production Date: {{ sample.batch.production_date }}<br>
<a href="{% url 'admin:yeast_yeast_change' sample.id %}">Admin Page</a>
<b>Batch Source:</b> {{ batch.get_source_display }}
{% if batch.source_batch %}
from <a href="{{ batch.beer_url }}" target="_blank" rel="noopener noreferrer">#{{ batch.beer_num }}: {{ batch.beer_name }}</a>
{% endif %}<br>
<b>Production Date:</b> {{ sample.batch.production_date }}<br>
<p><p>
{% for sample in batch.remaining_samples %}
<ul>
{% if batch.remaining_samples %}<h4>Batch Samples Remaining</h4>
<ul>
{% for sample in batch.remaining_samples %}
<li><a href="{% url 'yeast:yeast' sample.id %}">{{ sample.id }}</a> - Storage method: {{ sample.storage.name }} for {{ sample.age }} days, Viability: {{ sample.viability|mul:100|floatformat:1 }}%</li>
</ul>
{% endfor %}
{% for sample in batch.used_samples %}
<ul>
</ul>
{% endif %}
{% if batch.used_samples %}<h4>Batch Samples Used</h4>
<ul>
{% for sample in batch.used_samples %}
<li><a href="{% url 'yeast:yeast' sample.id %}">{{ sample.id }}</a></li>
</ul>
{% endfor %}
</ul>
{% endif %}
</div> <!-- /container -->
{% endblock %}