I am trying to insert a list of objects by using serializer.save() but when I try to insert existing data it throws error and doesn't pass the validation how can I modify the is_valid() method or is there any way of skipping the existing objects and inserting the others inside the method
Saving:
data = sanitizer.to_dict()serializer = serializer_class(data=data, many=True)if serializer.is_valid(raise_exception=True): serializer.save()Serializer:
from apps.trades.models import Tradefrom rest_framework import serializersclass TradeSerializer(serializers.ModelSerializer): class Meta: model = Trade fields = ['identifier', 'issue_date', 'maturity_date', 'invested_amount', 'interest_rate']The validation error:
[{"identifier":["trade with this identifier already exists."]}