wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
73 stars 59 forks source link

EmbeddedListField should allow empty list #5

Closed mitar closed 12 years ago

mitar commented 12 years ago

EmbeddedListField should probably allow empty list to be stored even with null=False?

mitar commented 12 years ago

It seems the default is required=False, but required=True means that list should not be empty. This probably means that null should behave like it does, only default for null should be True? To match that of MongoEngine? The problem is that default of TastyPie is False.

mitar commented 12 years ago

I don't understand what blank is for?

mitar commented 12 years ago

Maybe also an error message could be improved for lists?

Current example:

The document has an empty attribute 'comments' and does not allow a null value.

Better maybe:

The document has an empty list attribute 'comments' and does not allow a null value, empty list.

mitar commented 12 years ago

Or maybe just an error message and documentation change should be enough? Just to warn about this situation.

mitar commented 12 years ago

Not it should set null automatically based on required. If MongoEngine field is required, then setting field to [] fails. If not required, it can be [].