Recipe template needs to gracefully handle recipes with no ingredients. #12

Closed
opened 2024-06-18 20:55:18 -04:00 by cgiacofei · 0 comments
Owner
KeyError at /beer/recipes/1/

0

Request Method: 	GET
Request URL: 	https://brewery.giacofei.org/beer/recipes/1/
Django Version: 	5.0.6
Exception Type: 	KeyError
Exception Value: 	

0

Exception Location: 	/mnt/snapraid/WEB_DATA/brewery/beer/models.py, line 179, in srm_hex
Raised during: 	beer.views.view_recipe
Python Executable: 	/mnt/snapraid/WEB_DATA/brewery/.env/bin/python3
Python Version: 	3.11.7
Python Path: 	

['/mnt/snapraid/WEB_DATA/brewery',
 '/mnt/snapraid/WEB_DATA/brewery/.env/bin',
 '/usr/lib/python311.zip',
 '/usr/lib/python3.11',
 '/usr/lib/python3.11/lib-dynload',
 '/mnt/snapraid/WEB_DATA/brewery/.env/lib/python3.11/site-packages']

Server time: 	Tue, 18 Jun 2024 20:53:25 -0400

In template /mnt/snapraid/WEB_DATA/brewery/beer/templates/beer/recipe.html, error at line 11

.container-beer {
  background: {{ recipe.srm_hex }};
}
``` KeyError at /beer/recipes/1/ 0 Request Method: GET Request URL: https://brewery.giacofei.org/beer/recipes/1/ Django Version: 5.0.6 Exception Type: KeyError Exception Value: 0 Exception Location: /mnt/snapraid/WEB_DATA/brewery/beer/models.py, line 179, in srm_hex Raised during: beer.views.view_recipe Python Executable: /mnt/snapraid/WEB_DATA/brewery/.env/bin/python3 Python Version: 3.11.7 Python Path: ['/mnt/snapraid/WEB_DATA/brewery', '/mnt/snapraid/WEB_DATA/brewery/.env/bin', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/mnt/snapraid/WEB_DATA/brewery/.env/lib/python3.11/site-packages'] Server time: Tue, 18 Jun 2024 20:53:25 -0400 ``` `In template /mnt/snapraid/WEB_DATA/brewery/beer/templates/beer/recipe.html, error at line 11` ``` .container-beer { background: {{ recipe.srm_hex }}; } ```
cgiacofei added the
bug
label 2024-06-18 20:55:22 -04:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Brewery/brewery-website#12
No description provided.