From 9566f203a0970eddb2872cc1d5d061d859afd90d Mon Sep 17 00:00:00 2001 From: Chris Giacofei Date: Tue, 18 Jun 2024 15:16:22 -0400 Subject: [PATCH] Make a basic recipe display page. No modificiation possible from here yet. --- beer/static/beer_back.png | Bin 0 -> 3428 bytes beer/templates/beer/home.html | 119 +---------------------- beer/templates/beer/recipe.html | 165 ++++++++++++++++++++++++++++++++ beer/urls.py | 8 +- beer/views.py | 13 ++- 5 files changed, 186 insertions(+), 119 deletions(-) create mode 100644 beer/static/beer_back.png create mode 100644 beer/templates/beer/recipe.html diff --git a/beer/static/beer_back.png b/beer/static/beer_back.png new file mode 100644 index 0000000000000000000000000000000000000000..12bfbaf884b592f9f9ebefdae3ec536c486102e3 GIT binary patch literal 3428 zcmV-q4V&_bP)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H14Dm@s zK~#90?VW9m9#s{`f4eQaZMWT0`rcAmXeojyZ9&2K0tQ4Vi7!!OBE}DDVq#42i{YDw zuYUF;CPqbr3Vtw_#P~u9CW0uGBDR$mfl}xTcH082?RM7>XC`yz?mV;GeRgKfnYq8@ z$=sQFc5~)F|2g;EbMM?4n3|fJA`+>9!KMv}w3jHZNM%HEMJgkTD^eK?n>L^V-UW^V zZzkJgz+vDxa2hxRj3?W7fs;x3ZS_CSB;VDXOTM!dxF|Tc7+9qCmnQq8z>=hVak5 zVc>POeHnO(*z_Pd=0qz5yC^$EQG#NXR&((;iR@Y`-bsPm=1pWp5 zBl+y1xVgUx_&(yz%wbVn~HH}!|k86W{Gf8Ai;?lz>Lr6Xx_#wRU_OIJ!1*M*_$D~hWCT`6XAHBN}0YX)?sn94LeK*y(1Tm|TuYq&8hd@`iU zQCtP+N*U_;tw<3j#bs$Gs`gglOi#<``CKWdfC;rfksJ$WtZJ4Zvpts0!G_@;(a!5!!lS6L49w-Gt0g-4T30 zt*=20wMLf2HGoW`IZyH3x0U?xP@6fKeBMCjb7?jsQ@S;&xGepic2u5_R!-=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2G zx>p!ImykA#=6lT6#RZv&x+*Sxo#)A3Vz3(Hxjs+g(wS*}yv>B(=_uI?4$NP_2XUp% z!a4G<9_d2NbqRUzq~k5~*Y81Gz0wg~7y{}QZ$T8-ywEF=YCfQy2g3DDbs8cRo;kdU zD}4EZ`M9G`%ElF==b8t)EUwrrR*V)<_!iW*iz{pv_4S*-_9!mflnwnv&ovL|nV4N~ z7G0%cJcw%{lJ9}(p38g%_em(O^!jz3n8ky*AfKf#I^I^axK5M3sB+LGK|T7fr+*(Bhf| z-crY1ycW=-xK0Bn3y!x99do^fESV0DuGgcuAn(1xz_%@E&*d&V4}QfJ4gtAnCN6+c zo?y~dXOI-R+)}HGk@&mkWpsc4DJy!*kB~o1shg<+#pm^tf1ZEdYkNtCpS$Z_!SrA){zNq)t|=(%d5m**M=mep)aRk(koETt{tg7$c?vZ0?St_tZD&_jE~ z6%OyXT9ZrTSzK-PT%mW0&0cm$YA%BJ6EU4%z*>B?{0 zBW8o-ufuIH5B|laUsuuwafL6-((gLjh%-EjOE(X?^4lP;&^sMe<=8CNKreBP;OOCn z9)#nHZr*2IM4Q9~@Dm(O11?}|upd2F%`75&dqgO%+km~m7x6P4cmTK)_&xB$;GDj` zD6X0qOSZ2ToZAHa5_ksq7IxRN8U?-yJP+&wKFRbO;y|(;CO?7D1p`x4Q&Tg4%^Y7s z1hf#DUp`dw-P6FYfZqVS$&!*yuo3t$V*g#_7aIvV0jxmsTw}n?RU0?oczs9omSj5t zyac?rK#G^e5Jc|U(uOmO?JHYrHY#Bu2yb+|yUXBFjYmlaFZDQ~BTv)E^ zIUFZY!LPWkROJJdi%T;I>_|Sncn3H;%l|h*x!3H6J*phVRU=ze`3d0D^Z36%A0o8

Comming Soon?

+
    {% for recipe in recipes %} -
    -

    {{ recipe.name }}

    - - -
    - -
    -
    -
    Fermentables (xx.x lbs)
    - - - {% for f in recipe.recipefermentable_set.all %} - - {% endfor %} - -
    {{ f.quantity }}{{ f.fermentable.name }}
    -

    - Pre-Boil Gravity: 1.XXX
    - Original Gravity: 1.XXX
    - Color: XXX SRM -

    -
    -
    - - - -
    -
    -
    Hops (xx.x oz)
    - - - {% for h in recipe.recipehop_set.all %} - - {% endfor %} - -
    {{ h.quantity }}{{ h.hop.name }}{{ h.time }}
    -

    - Total IBU: XX
    - 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
    - - - - - - -
    -
    -
    - -
    - -
    -

    -


    -

    +

  • {{ recipe.name }}
  • {% endfor %} - +
{% 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)