Hello Sencer
You can add cuatom functions to your serializer to return the data with the
zerializer .
For example you can add :
def email_serializer(email):
if !email.endswith("gmail.com"):
raise SerializerError("Error wrong email address : ", email)
This is just an example your functions
Hello again,
For anyone interested, more detailed version was sent to stackoverflow:
https://stackoverflow.com/questions/73231297/proper-way-to-return-erroneous-data-with-serializer-error
Kind regards,
Sencer HAMARAT
On Wed, Aug 3, 2022 at 7:58 AM Sencer Hamarat
wrote:
> Hi,
>
> I found a wa
Hi,
I found a way to customize error messages of the serializer by adding
extra_kwargs into the serializer meta class.
But, I'm wishing to render custom serializer errors with the incorrect
data. For example:
class CreateUserSerializer(serializer.ModelSerializer):
class Meta:
model =
3 matches
Mail list logo