Make a basic recipe display page.
No modificiation possible from here yet.
This commit is contained in:
parent
d6aa8e8d6a
commit
9566f203a0
BIN
beer/static/beer_back.png
Normal file
BIN
beer/static/beer_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
@ -17,123 +17,10 @@ input, label {
|
|||||||
<div class="container" id="main">
|
<div class="container" id="main">
|
||||||
<h1>Comming Soon?</h1>
|
<h1>Comming Soon?</h1>
|
||||||
|
|
||||||
|
<ul>
|
||||||
{% for recipe in recipes %}
|
{% for recipe in recipes %}
|
||||||
<div class="container-fluid">
|
<li><a href="{% url 'beer:recipe' recipe.id %}">{{ recipe.name }}</a></li>
|
||||||
<h3>{{ recipe.name }}</h3>
|
|
||||||
|
|
||||||
<!-- Ferm and Hop Row -->
|
|
||||||
<div class="row">
|
|
||||||
<!-- Fermentables -->
|
|
||||||
<div class="col-md">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="container-fluid bg-dark text-white">Fermentables (xx.x lbs)</div>
|
|
||||||
<table class="table table-sm ">
|
|
||||||
<tbody>
|
|
||||||
{% for f in recipe.recipefermentable_set.all %}
|
|
||||||
<tr><td>{{ f.quantity }}</td><td>{{ f.fermentable.name }}</td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<p class="text-end small">
|
|
||||||
Pre-Boil Gravity: <b>1.XXX</b><br>
|
|
||||||
Original Gravity: <b>1.XXX</b><br>
|
|
||||||
Color: <b>XXX SRM</b>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Hops -->
|
|
||||||
<div class="col-md">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="container-fluid bg-dark text-white">Hops (xx.x oz)</div>
|
|
||||||
<table class="table table-sm ">
|
|
||||||
<tbody>
|
|
||||||
{% for h in recipe.recipehop_set.all %}
|
|
||||||
<tr><td>{{ h.quantity }}</td><td>{{ h.hop.name }}</td><td>{{ h.time }}</td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<p class="text-end small">
|
|
||||||
Total IBU: <b>XX</b><br>
|
|
||||||
BU/GU: <b>0.XX</b><br>
|
|
||||||
RBR: <b>0.XX</b>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Misc and Yeast Row -->
|
|
||||||
<div class="row">
|
|
||||||
<!-- Misc -->
|
|
||||||
<div class="col-md">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="container-fluid bg-dark text-white">Misc.</div>
|
|
||||||
<table class="table table-sm">
|
|
||||||
<tbody>
|
|
||||||
{% for m in recipe.recipemisc_set.all %}
|
|
||||||
<tr><td>{{ m.misc.name }}</td><td>{{ m.misc.quantity }}</td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Yeast -->
|
|
||||||
<div class="col-md">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="container-fluid bg-dark text-white">Yeast</div>
|
|
||||||
<table class="table table-sm">
|
|
||||||
<tbody>
|
|
||||||
{% for y in recipe.recipeyeast_set.all %}
|
|
||||||
<tr><td>{{ y.yeast.name }}</td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Mash and Fermentation Row -->
|
|
||||||
<div class="row">
|
|
||||||
<!-- Mash -->
|
|
||||||
<div class="col-md">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="container-fluid bg-dark text-white">Mash Profile {{ recipe.mash.name }}</div>
|
|
||||||
<table class="table table-sm ">
|
|
||||||
<tbody>
|
|
||||||
{% for step in recipe.mash.mashstep_set.all %}
|
|
||||||
<tr><td>{{ step.name }}</td><td>{{ step.step_temp }} °F</td><td>{{ step.step_time }} min</td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Fermentation -->
|
|
||||||
<div class="col-md">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="container-fluid bg-dark text-white">Fermentation Profile</div>
|
|
||||||
<table class="table table-sm">
|
|
||||||
<tbody>
|
|
||||||
<!-- {% for y in recipe.recipeyeast_set.all %} -->
|
|
||||||
<!-- <tr><td>{{ y.yeast.name }}</td></tr> -->
|
|
||||||
<!-- {% endfor %} -->
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<p>
|
|
||||||
<hr/>
|
|
||||||
<p>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
165
beer/templates/beer/recipe.html
Normal file
165
beer/templates/beer/recipe.html
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load mathfilters %}
|
||||||
|
{% load funcs %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block style %}
|
||||||
|
input, label {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
.container-beer {
|
||||||
|
background: {{ recipe.srm_hex }};
|
||||||
|
}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block title %}Recipes{% endblock %}
|
||||||
|
|
||||||
|
{% block jumbotron %}{{ recipe.name }}{% endblock %}
|
||||||
|
|
||||||
|
{% block jumbotronsub %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg d-flex justify-content-between" style="border:1px solid #cecece; margin-right:.5em; margin-left:.5em">
|
||||||
|
<div>
|
||||||
|
<div class="container-beer"><img src="{% static "beer_back.png" %}" alt="" class="img-responsive d-none d-sm-block"></div>
|
||||||
|
</div>
|
||||||
|
<dl class="row">
|
||||||
|
<dt>Recipe</dt>
|
||||||
|
<dd>{{ recipe.name }}</dd>
|
||||||
|
<dt>Author</dt>
|
||||||
|
<dd>Author</dd>
|
||||||
|
<dt>Type</dt>
|
||||||
|
<dd>All Grain</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3" style="border:1px solid #cecece; margin-right:.5em; margin-left:.5em">
|
||||||
|
<div>Equipment Selection</div>
|
||||||
|
<b>Batch Size:</b> {{ recipe.batch_size }} gal <b>Actual Volume:</b> {{ recipe.final_volume|floatformat:2 }}<br>
|
||||||
|
<b>Mash Efficiency:</b> {{ recipe.efficiency|floatformat:2 }} %
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3" style="border:1px solid #cecece; margin-right:.5em; margin-left:.5em">
|
||||||
|
Style Data
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container" id="main">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<!-- Ferm and Hop Row -->
|
||||||
|
<div class="row">
|
||||||
|
<!-- Fermentables -->
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="container-fluid bg-dark text-white">Fermentables ({{ fermentable_weight|floatformat:2 }} lbs)</div>
|
||||||
|
<table class="table table-sm ">
|
||||||
|
<tbody>
|
||||||
|
{% for f in recipe.recipefermentable_set.all %}
|
||||||
|
<tr><td>{{ f.quantity|floatformat:2 }} lb</td><td>{{ f.fermentable.name }}<br>{{ f.srm }}</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p class="text-end small">
|
||||||
|
Pre-Boil Gravity: <b>1.XXX</b><br>
|
||||||
|
Original Gravity: <b>{{ recipe.original_sg }}</b><br>
|
||||||
|
Color: <b>XXX SRM</b>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Hops -->
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="container-fluid bg-dark text-white">Hops ({{ hop_weight|floatformat:2 }} oz)</div>
|
||||||
|
<table class="table table-sm ">
|
||||||
|
<tbody>
|
||||||
|
{% for h in recipe.recipehop_set.all %}
|
||||||
|
<tr><td>{{ h.quantity|floatformat:2 }} oz</td><td>{{ h.hop.name }} {{ h.hop.alpha|floatformat:1 }} %<br>{{ h.ibu_tinseth|floatformat:1 }} IBU</td><td>{{ h.time }} min</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p class="text-end small">
|
||||||
|
Total IBU: <b>{{ recipe.ibu_tinseth|floatformat:1 }}</b><br>
|
||||||
|
BU/GU: <b>0.XX</b><br>
|
||||||
|
RBR: <b>0.XX</b>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Misc and Yeast Row -->
|
||||||
|
<div class="row">
|
||||||
|
<!-- Misc -->
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="container-fluid bg-dark text-white">Misc.</div>
|
||||||
|
<table class="table table-sm">
|
||||||
|
<tbody>
|
||||||
|
{% for m in recipe.recipemisc_set.all %}
|
||||||
|
<tr><td>{{ m.misc.name }}</td><td>{{ m.misc.quantity }}</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Yeast -->
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="container-fluid bg-dark text-white">Yeast</div>
|
||||||
|
<table class="table table-sm">
|
||||||
|
<tbody>
|
||||||
|
{% for y in recipe.recipeyeast_set.all %}
|
||||||
|
<tr><td>{{ y.yeast.name }}</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Mash and Fermentation Row -->
|
||||||
|
<div class="row">
|
||||||
|
<!-- Mash -->
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="container-fluid bg-dark text-white">Mash Profile {{ recipe.mash.name }}</div>
|
||||||
|
<table class="table table-sm ">
|
||||||
|
<tbody>
|
||||||
|
{% for step in recipe.mash.mashstep_set.all %}
|
||||||
|
<tr><td>{{ step.name }}</td><td>{{ step.step_temp }} °F</td><td>{{ step.step_time }} min</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Fermentation -->
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="container-fluid bg-dark text-white">Fermentation Profile</div>
|
||||||
|
<table class="table table-sm">
|
||||||
|
<tbody>
|
||||||
|
<!-- {% for y in recipe.recipeyeast_set.all %} -->
|
||||||
|
<!-- <tr><td>{{ y.yeast.name }}</td></tr> -->
|
||||||
|
<!-- {% endfor %} -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<hr/>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -1,6 +1,10 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import home
|
from django.conf import settings
|
||||||
|
from django.conf.urls.static import static
|
||||||
|
from .views import home, view_recipe
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', home, name='home'),
|
path('', home, name='home'),
|
||||||
]
|
path('recipes/<int:recipe_id>/', view_recipe, name='recipe'),
|
||||||
|
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView, CreateView
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
|
||||||
from .models import UserProfile, BatchRecipe, Batch
|
from .models import UserProfile, BatchRecipe, Batch
|
||||||
@ -36,3 +36,14 @@ def home(request):
|
|||||||
batch_obj.save()
|
batch_obj.save()
|
||||||
|
|
||||||
return render(request, 'beer/home.html',{'recipes':BatchRecipe.objects.all()})
|
return render(request, 'beer/home.html',{'recipes':BatchRecipe.objects.all()})
|
||||||
|
|
||||||
|
def view_recipe(request, recipe_id):
|
||||||
|
recipe = get_object_or_404(BatchRecipe, pk=recipe_id)
|
||||||
|
|
||||||
|
context = {
|
||||||
|
'recipe': recipe,
|
||||||
|
'fermentable_weight': sum([x.quantity for x in recipe.fermentables]),
|
||||||
|
'hop_weight': sum([x.quantity for x in recipe.hops]),
|
||||||
|
}
|
||||||
|
|
||||||
|
return render(request, 'beer/recipe.html', context)
|
||||||
|
Loading…
Reference in New Issue
Block a user