umutbozkurt/django-rest-framework-mongoengine

Serializer Field: `default=0` gets ignored

acu192 opened this issue · 1 comments

Because of this line:

if model_field.default and not isinstance(model_field, me_fields.ComplexBaseField):

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.