sorry i didn't understand. could you please let me know what you want.

On Tuesday, 22 December 2020 at 03:30:47 UTC+5:30 djac...@exo.inc wrote:

> I have a ModelSerializer that I wish to require certain fields, even 
> though it is possible for the model it is based on to have null values for 
> those fields.
>
> However, I cannot instantiate a serializer like this:
> `s = MySerializer(model_instance)`
>
> and then call `s.is_valid()` since that method only works if I initialized 
> the serializer with a dictionary.
>
> If I just create the serializer and grab the data from it without 
> attempting to call is_valid, it does not respect the constraints in the 
> serializer itself.
>
> Any suggestions on how to solve this problem?
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/e186ff1d-e72b-4d32-9c7d-75d1f9dc0f7cn%40googlegroups.com.

Reply via email to