1👍
You have to override the create method on the serializer, something like this:
class accessTokenSerializer(serializer.X):
def create(self, validated_data):
return YourModel.objects.get_or_create(name=validated_data.pop("name"), defaults=validated_data)[0]
Source:stackexchange.com