typeddjango / djangorestframework-stubs

PEP-484 stubs for django-rest-framework
MIT License
439 stars 115 forks source link

Allow passing `None`, `empty` to `ModelSerializer.__init__()` `default=` and `initial=` kwargs #521

Closed intgr closed 6 months ago

intgr commented 9 months ago

I have made danks!

Re-using the same _DefaultInitial[] type alias that's used for default= and initial= of most Field classes. The semantics are exactly the same. Mostly default=None is useful for ModelSerializer nested in another serializer.