summaryrefslogtreecommitdiff
path: root/kitchen/views.py
diff options
context:
space:
mode:
authorCaine <caine@jihakuz.xyz>2026-04-02 16:33:31 +0100
committerCaine <caine@jihakuz.xyz>2026-04-02 16:33:31 +0100
commitfe00286f7558d379d392f8a46d10a4689f95d472 (patch)
tree23a27fc7b8c97b56e30d9a7bd9135a921be83209 /kitchen/views.py
parent487bf469795d70fb2bfdbee882d00f0c5e726a9a (diff)
Add API: URLs, token auth, what-can-i-cook endpoint, log-cook with pantry deduction, browsable API
Diffstat (limited to 'kitchen/views.py')
-rw-r--r--kitchen/views.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/kitchen/views.py b/kitchen/views.py
index 7521e50..58685ab 100644
--- a/kitchen/views.py
+++ b/kitchen/views.py
@@ -205,8 +205,12 @@ def what_can_i_cook(request):
warnings = get_pantry_warnings(base.ingredient_id)
if available < needed:
- if base.ingredient.is_staple_ingredient:
- # Staples like oil/salt — assume always available even if tracking says 0
+ # Check if this ingredient is tracked as a staple in the pantry
+ is_staple = PantryItem.objects.filter(
+ ingredient=base.ingredient, is_staple=True
+ ).exists()
+ if is_staple:
+ # Staples like oil/salt — assume always available
pass
else:
recipe_result["base_missing"].append({