jazzband / jsonmodels

jsonmodels is library to make it easier for you to deal with structures that are converted to, or read from JSON.
http://jsonmodels.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
334 stars 51 forks source link

default in field #81

Closed faststare closed 6 years ago

faststare commented 7 years ago

how I set default when I user doesn't fill up the field?

beregond commented 7 years ago

Hi @faststare

For now simplest way would be to set some value in __init__ (don't forget to call super() later). You could also try to subclass field and overwrite get_default_value but this way can be tricky.