diff options
| author | Tom Flux <tom@tomflux.xyz> | 2026-06-23 19:55:16 +0100 |
|---|---|---|
| committer | Tom Flux <tom@tomflux.xyz> | 2026-06-23 19:55:16 +0100 |
| commit | 0aabf50834a31ff4ae9f8fd58639e444a449110b (patch) | |
| tree | 3c0033c8326268e098ebf4bac020d5a427ee3f9c /kitchen/management | |
| parent | e34081ce36d1993912dad514127924440437a2e9 (diff) | |
Phase 1: mobile-first pantry redesign with In/Low/Out state
Track presence (In/Low/Out) as the primary signal instead of exact
quantities; quantity becomes an optional integer, unit optional too
(migration 0003 backfills state from quantity: 0 -> out, else in).
- Pantry rebuilt as a phone-first card list: colored state rail,
segmented In/Low/Out switch (server-driven HTMX), greyed out-items,
live summary counts.
- Fast add: bottom add bar with type-ahead autocomplete, location
picker, and quick-add chips for things you've run out of.
- Per-item menu (move / set expiry / delete); expiry is now an
optional quiet pill, never required.
- New endpoints: pantry search + set-state; dropped the old
edit-expiry/cancel flow and its partial.
- Recipes matcher made presence-based (have-it beats have-enough);
state added to admin. Tests cover state, add/restock, search,
presence matching, and page rendering.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'kitchen/management')
| -rw-r--r-- | kitchen/management/commands/seed.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kitchen/management/commands/seed.py b/kitchen/management/commands/seed.py index 522e178..d79adf6 100644 --- a/kitchen/management/commands/seed.py +++ b/kitchen/management/commands/seed.py @@ -94,14 +94,15 @@ class Command(BaseCommand): # --- Pantry Items (from current Pantry.md as of 31 Mar 2026) --- self.stdout.write("Creating pantry items...") - def add_pantry(name, qty, unit, location, expiry=None, is_staple=False, notes=""): + def add_pantry(name, qty, unit, location, expiry=None, is_staple=False, notes="", state="in"): # Use ingredient + location for lookup so same ingredient can exist # in multiple locations (e.g. sausages in fridge AND freezer) PantryItem.objects.get_or_create( ingredient=ingredients[name], location=location, defaults={ - "quantity": Decimal(str(qty)), + "state": state, + "quantity": int(qty), "unit": unit, "expiry_date": expiry, "is_staple": is_staple, @@ -132,7 +133,7 @@ class Command(BaseCommand): add_pantry(name, 1, "n/a", "cupboard", is_staple=True) # Out of stock (for reference) - add_pantry("eggs", 0, "items", "fridge", notes="OUT — restock") + add_pantry("eggs", 0, "items", "fridge", notes="OUT — restock", state="out") add_pantry("baked beans", 1, "tins", "cupboard") add_pantry("freezer bags", 1, "boxes", "cupboard") |
