Fixes: Add a debugging log for address creation
This commit is contained in:
parent
d0362fe02f
commit
e775b8233d
3 changed files with 15 additions and 1 deletions
|
|
@ -1,8 +1,12 @@
|
||||||
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from constance import config
|
from constance import config
|
||||||
from django.contrib.gis.geos import Point
|
from django.contrib.gis.geos import Point
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
logger = logging.getLogger("django.request")
|
||||||
|
|
||||||
|
|
||||||
class AddressManager(models.Manager):
|
class AddressManager(models.Manager):
|
||||||
def create(self, raw_data: str, **kwargs):
|
def create(self, raw_data: str, **kwargs):
|
||||||
|
|
@ -46,6 +50,8 @@ class AddressManager(models.Manager):
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
location = None
|
location = None
|
||||||
|
|
||||||
|
logger.debug("Address creation kwargs: %s", kwargs)
|
||||||
|
|
||||||
# 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,
|
||||||
|
|
|
||||||
|
|
@ -920,7 +920,10 @@ class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel):
|
||||||
self.feedback.delete()
|
self.feedback.delete()
|
||||||
return None
|
return None
|
||||||
if action == "add" and not self.feedback:
|
if action == "add" and not self.feedback:
|
||||||
|
if self.order.status not in ["MOMENTAL", "PENDING"]:
|
||||||
return Feedback.objects.create(rating=rating, comment=comment, order_product=self)
|
return Feedback.objects.create(rating=rating, comment=comment, order_product=self)
|
||||||
|
else:
|
||||||
|
raise ValueError(_("you cannot feedback an order which is not received"))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
|
@ -108,6 +109,8 @@ from core.utils.nominatim import fetch_address_suggestions
|
||||||
from evibes.settings import DEBUG
|
from evibes.settings import DEBUG
|
||||||
from payments.serializers import TransactionProcessSerializer
|
from payments.serializers import TransactionProcessSerializer
|
||||||
|
|
||||||
|
logger = logging.getLogger("django.request")
|
||||||
|
|
||||||
|
|
||||||
class EvibesViewSet(ModelViewSet):
|
class EvibesViewSet(ModelViewSet):
|
||||||
action_serializer_classes = {}
|
action_serializer_classes = {}
|
||||||
|
|
@ -642,6 +645,8 @@ class AddressViewSet(EvibesViewSet):
|
||||||
create_serializer = AddressCreateSerializer(data=request.data, context={"request": request})
|
create_serializer = AddressCreateSerializer(data=request.data, context={"request": request})
|
||||||
create_serializer.is_valid(raise_exception=True)
|
create_serializer.is_valid(raise_exception=True)
|
||||||
|
|
||||||
|
logger.debug(f"Creating address with data: {create_serializer.validated_data}")
|
||||||
|
|
||||||
address_obj = create_serializer.create(create_serializer.validated_data)
|
address_obj = create_serializer.create(create_serializer.validated_data)
|
||||||
|
|
||||||
output_serializer = AddressSerializer(address_obj, context={"request": request})
|
output_serializer = AddressSerializer(address_obj, context={"request": request})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue