def post(self, request, format=None): try: body_unicode = request.body.decode('utf-8') body = json.loads(body_unicode) gc = GeoCompleteHandler(body) response_data = gc.build_response() except Exception as e: return Response({"message": str(e)}, status=status.HTTP_400_BAD_REQUEST) return Response(response_data)
def post(self, request, geocomplete=False, format=None): try: body_unicode = request.body.decode('utf-8') body = json.loads(body_unicode) response_data = None if not geocomplete: dq = DataQueryHandler(Location, LocationSerializer, body) response_data = dq.build_response() else: gc = GeoCompleteHandler(body) response_data = gc.build_response() except Exception as e: return Response({"message": str(e)}, status=status.HTTP_400_BAD_REQUEST) return Response(response_data)