Fixes: AddressManager
This commit is contained in:
parent
f97d84ae58
commit
8d3b0bd67f
1 changed files with 11 additions and 1 deletions
|
|
@ -52,10 +52,20 @@ class AddressManager(models.Manager):
|
||||||
|
|
||||||
logger.debug("Address creation kwargs: %s", kwargs)
|
logger.debug("Address creation kwargs: %s", kwargs)
|
||||||
|
|
||||||
|
try:
|
||||||
|
address_line_1 = kwargs.pop('address_line_1')
|
||||||
|
except KeyError:
|
||||||
|
raise ValueError("Missing required field 'address_line_1'") from e
|
||||||
|
|
||||||
|
try:
|
||||||
|
address_line_2 = kwargs.pop('address_line_2')
|
||||||
|
except KeyError:
|
||||||
|
address_line_2 = ""
|
||||||
|
|
||||||
# Create the model instance, storing both the input string and full API response
|
# Create the model instance, storing both the input string and full API response
|
||||||
return super().create(
|
return super().create(
|
||||||
raw_data=raw_data,
|
raw_data=raw_data,
|
||||||
address_line=f"{kwargs.get('address_line_1')}, {kwargs.get('address_line_2')}",
|
address_line=f"{address_line_1}, {address_line_2}",
|
||||||
street=street,
|
street=street,
|
||||||
district=district,
|
district=district,
|
||||||
city=city,
|
city=city,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue