diff --git a/CLAUDE.md b/CLAUDE.md index d53b284..9fc088c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -158,6 +158,7 @@ Pytest settings are in `pyproject.toml` under `[tool.pytest.ini_options]` (`DJAN ## Conventions for AI assistants - **Never write to `GeneratedField`s** (`duration_calculated`, `duration_total`, `price_per_game`, `days_to_finish`). They are computed by the database. +- **Name variables with complete words** — readable, unabbreviated identifiers in both Python and JavaScript (e.g. `template` not `tpl`, `event` not `e`, `element` not `el`, `removeButton` not `removeBtn`, `option`/`value` not single letters in loops). This applies to new code and to code you touch. - **Use `render_page()` not `render()`** for all full-page HTTP responses. Import from `common.layout`. - **Build UI with Python components** from `common.components`, not raw HTML strings or Django templates. `SafeText` children pass through unescaped; plain strings are auto-escaped. - **Filter views** accept `?filter=` (structured) and fall back to `?search_string=` (free-text). New filter criteria go in `games/filters.py`; new criterion types go in `common/criteria.py`. diff --git a/common/components/filters.py b/common/components/filters.py index f00ce3d..783d8e3 100644 --- a/common/components/filters.py +++ b/common/components/filters.py @@ -106,8 +106,8 @@ def _resolve_game_options(ids): from games.models import Game return [ - {"value": g.id, "label": g.search_label} - for g in Game.objects.filter(pk__in=ids) + {"value": game.id, "label": game.search_label} + for game in Game.objects.filter(pk__in=ids) ] @@ -116,7 +116,10 @@ def _resolve_device_options(ids): return [] from games.models import Device - return [{"value": d.id, "label": d.name} for d in Device.objects.filter(pk__in=ids)] + return [ + {"value": device.id, "label": device.name} + for device in Device.objects.filter(pk__in=ids) + ] def _resolve_platform_options(ids): @@ -125,7 +128,8 @@ def _resolve_platform_options(ids): from games.models import Platform return [ - {"value": p.id, "label": p.name} for p in Platform.objects.filter(pk__in=ids) + {"value": platform.id, "label": platform.name} + for platform in Platform.objects.filter(pk__in=ids) ] diff --git a/common/components/search_select.py b/common/components/search_select.py index 91a76bc..0725208 100644 --- a/common/components/search_select.py +++ b/common/components/search_select.py @@ -63,8 +63,9 @@ _ROW_HEIGHT_REM = 2.25 # ── FilterSelect styling ─────────────────────────────────────────────────── # Inline class strings (ported verbatim from the retired SelectableFilter CSS) -# so the filter combobox is fully self-styled — nothing in input.css. The -# JS-built filter rows/pills in search_select.js mirror these byte-for-byte. +# so the filter combobox is fully self-styled — nothing in input.css. JS-added +# rows/pills are cloned from server-rendered