From aef9f02469657451e6e512100143f16a3ffe3748 Mon Sep 17 00:00:00 2001 From: "Mees, T.D. (Ty)" Date: Thu, 1 Feb 2024 15:12:36 +0100 Subject: [PATCH] fix: made sure fixtures are loaded in the correct order --- main/management/commands/load_fixtures.py | 4 +++- tasks/fixtures/{registrations.json => 00_registrations.json} | 0 .../{registrationkinds.json => 01_registrationkinds.json} | 0 3 files changed, 3 insertions(+), 1 deletion(-) rename tasks/fixtures/{registrations.json => 00_registrations.json} (100%) rename tasks/fixtures/{registrationkinds.json => 01_registrationkinds.json} (100%) diff --git a/main/management/commands/load_fixtures.py b/main/management/commands/load_fixtures.py index 47a091100..617f1ea53 100644 --- a/main/management/commands/load_fixtures.py +++ b/main/management/commands/load_fixtures.py @@ -7,6 +7,8 @@ def list_fixtures_in_dir(rel_path): files = os.listdir(rel_path) + # Sort the list alphabetically for consistent load-order + files.sort() def is_fixture(fn): return fn.lower()[-5:] == ".json" @@ -15,11 +17,11 @@ def is_fixture(fn): fixture_dirs = { + "main": list_fixtures_in_dir("main/fixtures/"), "proposals": list_fixtures_in_dir("proposals/fixtures/"), "studies": list_fixtures_in_dir("studies/fixtures/"), "tasks": list_fixtures_in_dir("tasks/fixtures/"), "observations": list_fixtures_in_dir("observations/fixtures/"), - "main": list_fixtures_in_dir("main/fixtures/"), } diff --git a/tasks/fixtures/registrations.json b/tasks/fixtures/00_registrations.json similarity index 100% rename from tasks/fixtures/registrations.json rename to tasks/fixtures/00_registrations.json diff --git a/tasks/fixtures/registrationkinds.json b/tasks/fixtures/01_registrationkinds.json similarity index 100% rename from tasks/fixtures/registrationkinds.json rename to tasks/fixtures/01_registrationkinds.json