Quick Reference
Version 2 · Added /guide/ routes and cache keys, corrected DB name to qdb, linked the new detailed API/DB/architecture pages
Runner Form — Quick Reference
For full detail see [[api-reference]] (endpoints), [[database-schema]] (tables/columns), and [[architecture]] (request flow, deployment).
Run locally
.\venv\Scripts\Activate.ps1
python manage.py runserver
# http://127.0.0.1:8000/ — login: admin / (see views.py, dev-only)
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/guide/ ?date= ?country= ?race=
/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 |
runner_form/templates/runner_form/form-guide.html |
Meeting/race browse page |
Core DB (MySQL qdb @ 138.226.220.168:3306)
runner, run, race, meeting, jockey, trainers, courses, country,
trial_race, trial_run, trial_meeting, sales, sales_lots, sales_lookup,
generic_lookup.
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 prefix runner_form:, versioned suffixes like v2/v7)
| Data | TTL |
|---|---|
Runner/jockey/trainer form data (data:v7:{id}) |
120s |
Sales info (sales:v3:{id}) |
600s |
Search results (horse_search:{q}) |
180s |
Available dates (available_dates) |
300s |
| Meetings/races/runners for date or race | 300s |
Form guide meetings+races (form_guide:v2:...) |
120s |
| Form guide date/country filters | 300s |
Full table with every key: [[api-reference]].
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.