Premier League Predictor: Django & MySQL — Chapter 10, Exercise 3 ==================================================== TASK Build the selector into a real setup with at least two seasons and two gameweeks, enter a fixture in one gameweek, navigate to the other gameweek and back using only the selector dropdowns, and confirm the previously-entered fixture's own two teams are still shown disabled — then explain specifically why this works even though no client-side state was ever preserved across the navigation at all. SOLUTION Using season 1 (2026/27) with gameweek_id 5 and gameweek_id 6, both already existing: 1. Visit /gameweeks/5/fixtures/. The team grid renders with every button enabled, since gameweek 5 has no fixtures yet. 2. Click two teams to select them (say Arsenal and Chelsea) and click "Add Fixture." create_fixture creates a real Fixture row for gameweek 5, and addFixture()'s own JS updates usedTeamIds and calls disableUsedButtons(), so both buttons show disabled immediately on this same page, without a reload. 3. Use the gameweek selector dropdown (not the browser's back button, not a manual URL edit) to switch to Gameweek 6. This triggers location.href = '/gameweeks/6/fixtures/' — a genuine full page navigation, not an in-page update. 4. On the new page load for gameweek 6, fixture_entry runs completely fresh: it queries Fixture.objects.filter(gameweek=), which is empty, so used_team_ids is an empty set and every button renders without the disabled attribute. The page for gameweek 6 correctly shows all 20 teams available, as expected — it has no memory of gameweek 5's own fixture at all, because it's a completely separate page render. 5. Use the gameweek selector again to switch back to Gameweek 5: location.href = '/gameweeks/5/fixtures/' loads yet another fresh page. fixture_entry runs again, queries Fixture.objects.filter(gameweek=) again, finds the real fixture created in step 2, and computes used_team_ids = {Arsenal's id, Chelsea's id} again — correctly, because it's reading the real row from the database, not any leftover in-memory JavaScript state. 6. The rendered HTML for this reload of gameweek 5 shows both Arsenal's and Chelsea's buttons with the disabled attribute already present, and fixtures.js's own opening line — new Set(Array.from(document.querySelectorAll('#team-grid button[disabled]'))...) — seeds usedTeamIds correctly from those already-disabled buttons the instant the page loads. Why this works with zero preserved client-side state: every single navigation in this sequence is a full page load, and fixture_entry recomputes used_team_ids from the real Fixture table on every single one of those loads. There's nothing to "lose" between gameweek 5 and gameweek 6, because nothing was ever being remembered across pages in the first place — the correctness comes entirely from the server re-deriving the truth fresh each time, not from any state surviving the trip. WHY THIS WORKS AS AN ANSWER ---------------------------- It walks through a real sequence using genuine page navigations (not just describing the concept), shows the disabled state correctly disappearing on the empty gameweek and correctly reappearing on the return to the fixtured one, and explicitly explains that the mechanism is fresh server-side recomputation on every load rather than any preserved client-side memory — the actual distinction the exercise is testing for.