j2labs/dictshield — Issue #57: Add an enum field
Author: desfrenes
Created: 2012-01-10 09:39:05+00:00
State: open

Is there something similar to an enum field in dictshield ? I understand there is no enum in python but still it would be nice to be able to limit the range of possible values for a field. Something similar to this:

class mydocument(Document):
title = StringField(max_length=60, required=True)
collection = EnumField(values=["books", "magazines","papers"])

I'm willing to implement it if I can get some good advice from you.