diff --git a/app/backend/gwells/fixtures/wellsearch-codetables.json b/app/backend/gwells/fixtures/wellsearch-codetables.json index 74103740b..7337dcf0d 100644 --- a/app/backend/gwells/fixtures/wellsearch-codetables.json +++ b/app/backend/gwells/fixtures/wellsearch-codetables.json @@ -1225,7 +1225,7 @@ "create_date": "2017-07-01T08:00:00Z", "update_user": "ETL_USER", "update_date": "2017-07-01T08:00:00Z", - "description": "Dugout", + "description": "Dug", "display_order": 50, "effective_date": "2018-05-25T07:00:00Z", "expiry_date": "9999-12-31T23:59:59Z" diff --git a/app/backend/wells/management/commands/update_drilling_method_codes.py b/app/backend/wells/management/commands/update_drilling_method_codes.py new file mode 100644 index 000000000..4ab58522f --- /dev/null +++ b/app/backend/wells/management/commands/update_drilling_method_codes.py @@ -0,0 +1,18 @@ +from django.core.management.base import BaseCommand +from wells.models import DrillingMethodCode +from collections import defaultdict +import json + +class Command(BaseCommand): + help = "Update a value in the drilling_methods_code table" + def update_drilling_method_codes(self): + drilling_method_codes = open("gwells/fixtures/wellsearch-codetables.json") + drilling_method_codes = json.load(drilling_method_codes) + + for item in drilling_method_codes: + if item["model"] == "wells.drillingmethodcode": + DrillingMethodCode.objects.update_or_create(pk=item["pk"], defaults=item["fields"]) + + def handle(self, *args, **options): + self.update_drilling_method_codes() + print("update_drilling_method_codes.py completed successfully")