Closed Laisky closed 9 years ago
The first one might be a bug on EmailField. Can you try it with a StringField to see if it works?
The second one you can do with defaults. Just use default=lambda item: item.name or item.account
.
This is slightly different than what you want, though. It will save the value on mongo upon saving the document. There's no way to have a default value only when retrieving the document.
Hope this helps!
Thanks.
If there is a
users
collection, someone has email and the others do not, how can I create a Users-document that can hold a document without the keyemail
?I want to create a document like that
But I got TypeError: expected string or buffer
BTW, There is another requirement that I want define a key that it's defalut value is anthor key's value,
as the uppon code, If I not pass the argument
name
, I want get a document like thatIs there any possible to do like that?