diff --git a/beer/static/beer_back.png b/beer/static/beer_back.png new file mode 100644 index 0000000..12bfbaf Binary files /dev/null and b/beer/static/beer_back.png differ diff --git a/beer/templates/beer/home.html b/beer/templates/beer/home.html index b94d759..28e2f57 100644 --- a/beer/templates/beer/home.html +++ b/beer/templates/beer/home.html @@ -17,123 +17,10 @@ input, label {

Comming Soon?

+
{% endblock %} diff --git a/beer/templates/beer/recipe.html b/beer/templates/beer/recipe.html new file mode 100644 index 0000000..854d4f1 --- /dev/null +++ b/beer/templates/beer/recipe.html @@ -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 %} + +
+
+
+
+
+
+
Recipe
+
{{ recipe.name }}
+
Author
+
Author
+
Type
+
All Grain
+
+
+
+
Equipment Selection
+ Batch Size: {{ recipe.batch_size }} gal Actual Volume: {{ recipe.final_volume|floatformat:2 }}
+ Mash Efficiency: {{ recipe.efficiency|floatformat:2 }} % +
+
+ Style Data +
+
+ +{% endblock %} + + +{% block content %} +
+
+ +
+ +
+
+
Fermentables ({{ fermentable_weight|floatformat:2 }} lbs)
+ + + {% for f in recipe.recipefermentable_set.all %} + + {% endfor %} + +
{{ f.quantity|floatformat:2 }} lb{{ f.fermentable.name }}
{{ f.srm }}
+

+ Pre-Boil Gravity: 1.XXX
+ Original Gravity: {{ recipe.original_sg }}
+ Color: XXX SRM +

+
+
+ + + +
+
+
Hops ({{ hop_weight|floatformat:2 }} oz)
+ + + {% for h in recipe.recipehop_set.all %} + + {% endfor %} + +
{{ h.quantity|floatformat:2 }} oz{{ h.hop.name }} {{ h.hop.alpha|floatformat:1 }} %
{{ h.ibu_tinseth|floatformat:1 }} IBU
{{ h.time }} min
+

+ Total IBU: {{ recipe.ibu_tinseth|floatformat:1 }}
+ BU/GU: 0.XX
+ RBR: 0.XX +

+
+
+ +
+ + +
+ +
+
+
Misc.
+ + + {% for m in recipe.recipemisc_set.all %} + + {% endfor %} + +
{{ m.misc.name }}{{ m.misc.quantity }}
+
+
+ +
+
+
Yeast
+ + + {% for y in recipe.recipeyeast_set.all %} + + {% endfor %} + +
{{ y.yeast.name }}
+
+
+ +
+ + +
+ +
+
+
Mash Profile {{ recipe.mash.name }}
+ + + {% for step in recipe.mash.mashstep_set.all %} + + {% endfor %} + +
{{ step.name }}{{ step.step_temp }} °F{{ step.step_time }} min
+ + + +
+
+ +
+
+
Fermentation Profile
+ + + + + + +
+
+
+ +
+ +
+

+


+

+ +

+{% endblock %} diff --git a/beer/urls.py b/beer/urls.py index 1ca22ac..0fdd92f 100644 --- a/beer/urls.py +++ b/beer/urls.py @@ -1,6 +1,10 @@ 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 = [ path('', home, name='home'), -] + path('recipes//', view_recipe, name='recipe'), +] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/beer/views.py b/beer/views.py index 69bba47..0c7920c 100644 --- a/beer/views.py +++ b/beer/views.py @@ -1,5 +1,5 @@ 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 .models import UserProfile, BatchRecipe, Batch @@ -36,3 +36,14 @@ def home(request): batch_obj.save() 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)