diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-19 12:56:18 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-20 15:47:07 +0200 |
| commit | 9e7b90546562144abc2c7195743ec34507f57cc2 (patch) | |
| tree | 2e249bcdab3b92763d5723a957a16209105c0c22 /archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py | |
| parent | c10cdd8220589a4ce5bed01bc08cd11c92fdcdb5 (diff) | |
| download | Ishtar-9e7b90546562144abc2c7195743ec34507f57cc2.tar.bz2 Ishtar-9e7b90546562144abc2c7195743ec34507f57cc2.zip | |
🗃️ archaeological sites: new fields in database
- Types
- Current status
- Discovery status
- Discoverer
- Nature of site
- Interpretation level
- Precise locality
- Description
- Public description
Diffstat (limited to 'archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py')
| -rw-r--r-- | archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py b/archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py new file mode 100644 index 000000000..9840b6b7e --- /dev/null +++ b/archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py @@ -0,0 +1,34 @@ +from django.db import migrations +from ishtar_common.utils_migrations import migrations_load_data + + +def load_data(apps, __): + module_name = "archaeological_operations" + SiteCurrentStatusType = apps.get_model(module_name, "SiteCurrentStatusType") + SiteDiscoveryStatusType = apps.get_model(module_name, "SiteDiscoveryStatusType") + if not SiteDiscoveryStatusType.objects.count() or not SiteCurrentStatusType.objects.count(): + json_file = "0120_data_site_status.json" + migrations_load_data(module_name, json_file) + NatureOfSiteType = apps.get_model("archaeological_operations", "NatureOfSiteType") + if not NatureOfSiteType.objects.count(): + json_file = "0120_data_site_nature.json" + migrations_load_data(module_name, json_file) + InterpretationLevelType = apps.get_model("archaeological_operations", "InterpretationLevelType") + if not InterpretationLevelType.objects.count(): + json_file = "0120_data_site_interpretation.json" + migrations_load_data(module_name, json_file) + SiteType = apps.get_model("archaeological_operations", "SiteType") + if not SiteType.objects.count(): + json_file = "0120_data_site_type.json" + migrations_load_data(module_name, json_file) + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_operations', '0119_site_status_nature_interpretation'), + ] + + operations = [ + migrations.RunPython(load_data) + ] |
