You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am noticing an issue where the Address form field will only populate if the Address Instance of the AddressField has a full address populated. This issue seems to be originating from the to_dict method on the Address model.
In my instance, I am only populating the Country. I assume this means I do not have a Locality or State causing the country part of the below logic to not run.
def as_dict(self):
ad = dict(
street_number=self.street_number,
route=self.route,
raw=self.raw,
formatted=self.formatted,
latitude=self.latitude if self.latitude else "",
longitude=self.longitude if self.longitude else "",
)
if self.locality:
ad["locality"] = self.locality.name
ad["postal_code"] = self.locality.postal_code
if self.locality.state:
ad["state"] = self.locality.state.name
ad["state_code"] = self.locality.state.code
if self.locality.state.country:
ad["country"] = self.locality.state.country.name
ad["country_code"] = self.locality.state.country.code
return ad
The text was updated successfully, but these errors were encountered:
I am noticing an issue where the Address form field will only populate if the Address Instance of the AddressField has a full address populated. This issue seems to be originating from the
to_dict
method on theAddress
model.In my instance, I am only populating the Country. I assume this means I do not have a
Locality
orState
causing the country part of the below logic to not run.The text was updated successfully, but these errors were encountered: