-
Notifications
You must be signed in to change notification settings - Fork 1
/
resave_all_resrouces.py
28 lines (23 loc) · 1.06 KB
/
resave_all_resrouces.py
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
#Core arches imports
from arches.app.models.system_settings import settings
from arches.app.models.models import FunctionXGraph
from arches.app.models.tile import Tile
#Django imports
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
"""
Commands to load and resave all resources
"""
def handle(self, *args, **options):
#Get Ringfencing function
ringfencing_func_id = 'd92ad292-9ed7-11ec-8499-00155d22601c' #Replace with local uuid
ringfencing = FunctionXGraph.objects.get(pk = ringfencing_func_id)
#Get all triggering nodegroups from the ringfencing function
triggeringNodeGroups = ringfencing.config['triggering_nodegroups']
#For each triggering node group
for nodeGroup in triggeringNodeGroups:
#Get all tiles with the nodegroup id of triggering nodegroup
tiles = Tile.objects.filter(nodegroup_id = nodeGroup)
#Save each tile in the nodegroup
for tile in tiles:
tile.save()