Skip to content

Add demo data fixtures, fix deploy migrations, register admin models#53

Merged
emidiovaleretto merged 3 commits into
mainfrom
chore/fixtures
Jun 25, 2026
Merged

Add demo data fixtures, fix deploy migrations, register admin models#53
emidiovaleretto merged 3 commits into
mainfrom
chore/fixtures

Conversation

@emidiovaleretto

Copy link
Copy Markdown
Owner

What

Three related housekeeping changes bundled in this branch:

1. Demo data fixtures (fixtures/demo_data.json)

Adds a seed fixture with a demo account and realistic sample data so the live API is testable without manual setup:

  • demo_pilot user (login: demo_pilot / demo_pilot)
  • 4 aircraft (A320, A21N, B738, B77W)
  • 5 checklists + 9 checklist items across flight phases
  • 6 flights on real routes (EIDW↔EGLL, LEBL, LFPG, EHAM, LPPT)
  • 2 flight sessions

Load with: python manage.py loaddata fixtures/demo_data.json

2. Deploy migrations fix (railway.json)

The build uses the Dockerfile builder, so the Procfile's release: phase was being ignored and migrations never ran on deploy (production DB was left without tables). Adds preDeployCommand: python manage.py migrate so migrations run automatically on every deploy.

3. Register models in admin (checklist/admin.py, logbook/admin.py)

Registers the remaining models so they're manageable from the Django admin.

Notes

  • loaddata is a one-time manual seed (run once against production), not part of the deploy — the automated step only runs migrate, never loaddata, to avoid overwriting live data.
  • The fixture's demo_pilot is a regular user (no staff/superuser), so the demo account is contained.
  • Because loaddata bypasses model save(), Flight.duration stays null (expected). The demo user's profile is created via signal / get_or_create after load.

How to test locally

  1. python manage.py migrate
  2. python manage.py loaddata fixtures/demo_data.json
  3. Open /api/docs/, Authorize with demo_pilot / demo_pilot, and hit GET /api/flights/.

@emidiovaleretto emidiovaleretto self-assigned this Jun 25, 2026
@emidiovaleretto emidiovaleretto merged commit 45deb55 into main Jun 25, 2026
2 checks passed
@emidiovaleretto emidiovaleretto deleted the chore/fixtures branch June 25, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant