Add API: URLs, token auth, what-can-i-cook endpoint, log-cook with pantry deduction, browsable API

This commit is contained in:
Caine
2026-04-02 16:33:31 +01:00
parent 487bf46979
commit fe00286f75
4 changed files with 43 additions and 3 deletions
+6 -2
View File
@@ -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({