Skip to content

Commit

Permalink
add white label to create methods
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebPena committed Dec 10, 2024
1 parent 5a3b2c8 commit f71e4cc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions programs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,11 +779,11 @@ def from_model_data(self, data: DataType):
for county in data["counties"]:
try:
county_instance = County.objects.get(name=county["name"])
county_instance.white_label = white_label
county_instance.save()
except County.DoesNotExist:
county_instance = County.objects.create(name=county["name"])
county_instance = County.objects.create(name=county["name"], white_label=white_label)

county_instance.white_label = white_label
county_instance.save()
counties.append(county_instance)
navigator.counties.set(counties)

Expand Down Expand Up @@ -909,8 +909,10 @@ def from_model_data(self, data: DataType):
for county in data["counties"]:
try:
county_instance = County.objects.get(name=county["name"])
county_instance.white_label = white_label
county_instance.save()
except County.DoesNotExist:
county_instance = County.objects.create(name=county["name"])
county_instance = County.objects.create(name=county["name"], white_label=white_label)
counties.append(county_instance)
warning.counties.set(counties)

Expand Down Expand Up @@ -1055,8 +1057,10 @@ def from_model_data(self, data: DataType):
for county in data["counties"]:
try:
county_instance = County.objects.get(name=county["name"])
county_instance.white_label = white_label
county_instance.save()
except County.DoesNotExist:
county_instance = County.objects.create(name=county["name"])
county_instance = County.objects.create(name=county["name"], white_label=white_label)
counties.append(county_instance)
translation_override.counties.set(counties)

Expand Down

0 comments on commit f71e4cc

Please sign in to comment.