Skip to content

Commit

Permalink
fixup! refactor for text fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sekharpanja committed Oct 31, 2023
1 parent ee660cf commit f4ebaa8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def replace_func(field_name, find_str, replace_str):
return Func(F(field_name), Value(find_str), Value(replace_str), function="replace")


def search_and_replace_model(model):
def search_and_replace_all_fields(model):
model.objects.exclude(name__in=skip_items).update(
name=replace_func("name", dit, dbt),
short_description=replace_func("short_description", dit, dbt),
Expand Down Expand Up @@ -76,15 +76,15 @@ def search_and_replace_specific_fields(model):

def search_and_replace_catalogue_items(apps, _):
model = apps.get_model("datasets", "DataSet")
search_and_replace_model(model)
search_and_replace_all_fields(model)
search_and_replace_specific_fields(model)

model = apps.get_model("datasets", "VisualisationCatalogueItem")
search_and_replace_model(model)
search_and_replace_all_fields(model)
search_and_replace_specific_fields(model)

model = apps.get_model("datasets", "ReferenceDataset")
search_and_replace_model(model)
search_and_replace_all_fields(model)


class Migration(migrations.Migration):
Expand Down

0 comments on commit f4ebaa8

Please sign in to comment.