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/5f168307-1e9d-453a-847b-4bc0ea991868n%40googlegroups.com.

Reply via email to