Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

Field should have choices and help fields #125

Closed Jaymon closed 3 years ago

Jaymon commented 3 years ago

the choices should be the set of allowed values, any values set in field that aren't in choices should throw an error:

class Foo(Orm):
    bar = Field(str, True, choices=["che", "baz"])

f = Foo()
f.bar = "che" # no problem

f.bar = "boom" # raises ValueError because "boom" isn't in choices

Help would be similar to the help field in argparse:

bar = Field(str, True, help="The help string for the bar field")