From e716f88eace2f387e8c68feb826b96408934a1b6 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Sun, 8 Jun 2025 15:57:02 +0300 Subject: [PATCH] Fixes: AddressManager --- core/managers.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/managers.py b/core/managers.py index 5d283402..115f2e99 100644 --- a/core/managers.py +++ b/core/managers.py @@ -61,7 +61,7 @@ class AddressManager(models.Manager): address_line_2 = "" # Create the model instance, storing both the input string and full API response - return super().create( + return super().get_or_create( raw_data=raw_data, address_line=f"{address_line_1}, {address_line_2}", street=street, @@ -70,7 +70,6 @@ class AddressManager(models.Manager): region=region, postal_code=postal_code, country=country, - location=location, - api_response=data, + defaults={"api_response": data, "location": location}, **kwargs, - ) + )[0]