Skip to content

Commit

Permalink
replace lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
sekharpanja committed Nov 1, 2023
1 parent f4ebaa8 commit 79891fb
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
dbt = "DBT"
dit_full = "Department for International Trade"
dbt_full = "Department for Business and Trade"
dit_full_low = "department for international trade"


def replace_func(field_name, find_str, replace_str):
Expand All @@ -35,14 +36,20 @@ def search_and_replace_all_fields(model):
licence=replace_func("licence", dit, dbt),
restrictions_on_usage=replace_func("restrictions_on_usage", dit, dbt),
)

model.objects.exclude(name__in=skip_items).update(
name=replace_func("name", dit_full, dbt_full),
short_description=replace_func("short_description", dit_full, dbt_full),
description=replace_func("description", dit_full, dbt_full),
licence=replace_func("licence", dit_full, dbt_full),
restrictions_on_usage=replace_func("restrictions_on_usage", dit_full, dbt_full),
)
model.objects.exclude(name__in=skip_items).update(
name=replace_func("name", dit_full_low, dbt_full),
short_description=replace_func("short_description", dit_full_low, dbt_full),
description=replace_func("description", dit_full_low, dbt_full),
licence=replace_func("licence", dit_full_low, dbt_full),
restrictions_on_usage=replace_func("restrictions_on_usage", dit_full_low, dbt_full),
)


def search_and_replace_specific_fields(model):
Expand All @@ -54,6 +61,10 @@ def search_and_replace_specific_fields(model):
retention_policy=replace_func("retention_policy", dit_full, dbt_full),
personal_data=replace_func("personal_data", dit_full, dbt_full),
)
model.objects.exclude(name__in=skip_items).update(
retention_policy=replace_func("retention_policy", dit_full_low, dbt_full),
personal_data=replace_func("personal_data", dit_full_low, dbt_full),
)
for dataset in model.objects.exclude(name__in=skip_items).all():
if dataset.eligibility_criteria:
eligibility_criteria = list(dataset.eligibility_criteria)
Expand Down

0 comments on commit 79891fb

Please sign in to comment.