django-rest-framework-mongoengine
django-rest-framework-mongoengine copied to clipboard
Serializer Field: `default=0` gets ignored
Because of this line: https://github.com/umutbozkurt/django-rest-framework-mongoengine/blob/2ab11b39428f5c3ecc0712885884e3c325528e66/rest_framework_mongoengine/utils.py#L147
If default is "falsy" (like if you do default=0 on an IntField) then the default is ignored.
A workaround is to do default=lambda: 0 on your ME fields, instead of just the simple default=0.