blob: 9840b6b7e925bbbcca6ef11f1bab7a46709858a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
]
|