Quick Reference
Version 1 · Initial quick reference: routes, commands, DB tables, cache keys
Historical versionRunner Form — Quick Reference
Run locally
.\venv\Scripts\Activate.ps1
python manage.py runserver
# http://127.0.0.1:8000/ — login: admin / (see views.py)
Hard-refresh (Ctrl+Shift+R) after any static CSS/JS change.
Routes (mounted at /form/)
/form/runner/<horse_id>/ ?tab=brief|detailed ?date= ?race=
/form/jockey/<jockey_id>/
/form/trainer/<trainer_id>/
/form/api/dates/
/form/api/meetings/?date=
/form/api/races/?date=&meeting=
/form/api/runners/?race_id=
/form/api/search/?q=
Key files
| File | Role |
|---|---|
config/settings.py |
DB config, installed apps, cache, static files |
runner_form/queries.py |
All SQL queries + Python-side stats computation |
runner_form/views.py |
HTTP handlers + @custom_login_required |
runner_form/urls.py |
App routes |
runner_form/templates/runner_form/detailed-form.html |
Main runner detail page |
Core DB tables (qdg database, MySQL @ 138.226.220.168:3306)
runner, run, race, meeting, jockey, trainers, courses, country,
trial_race, trial_run
Notable columns:
run.vp_1200 / vp_800 / vp_600 / vp_400 / vp_200— sectional positions, NULL pre-2021; fall back torun.pos_1200,run.pos_800,run.pos_turn,run.pos_settling.trial_race.surface—T=Turf,AW=All-Weather,S=Synthetic,D=Dirt.run.gear_change— human-readable strings mapped viaGEAR_MAPPINGinqueries.py.
Cache
Key pattern: runner_form:<entity>:<id> (Django default in-memory cache).
| Data | TTL |
|---|---|
| Runner/jockey/trainer form data | 120s |
| Search results | 120s |
| Available dates | 300s |
Adding a new page/entity
- Add a query function in
queries.py. - Add a view in
views.pywith@custom_login_required. - Add a URL in
urls.py. - Create a template in
runner_form/templates/runner_form/. - Add navigation links in existing templates.