nickleman
nickleman
I had to make a custom validator that returns int to make this work. The ODMantic documentation refers to json encoders, but those don't seem to actually be used in...
The custom validator isn't doing what I thought it was doing. It was replacing the timedelta with an integer in the model class, not just the database. Looking at the...
Looks like I can do it with the following: ``` AsyncIOMotorClient( "mongodb://db_user:user_password@host:27017", type_registry=type_registry, ) ```
I simplified my example, but thinking about it, I'm no longer sure if I tested the simplified example. I'll dig in and do a bit more checking (first I'll update...
Well, with an update to everything, it so far appears to be working now. So, thanks for the fix. :)
Well, Roman, sorry, it had been so long since I looked at this, I forgot to switch back to save_changes() instead of save() on the model. It is still broken...
OK, I chased this down a bit more and figured out if you add class Config: validate_assignment = True tothe class that is what causes the issue on save_changes(). See...
``` class AddressForm(StarletteForm): street_addr = TextField( "Street Address", validators=[], ) city = TextField( "City", validators=[], ) state = TextField("State", validators=[Length(min=2, max=2)]) zipcode = TextField("Zipcode", validators=[Length(min=5, max=5)]) class CreateSchoolForm(StarletteForm): name =...
Another use case, I like to use the pydantic.condecimal type so I can also have validation of number of decimals and multiple of: ` stock: pydantic.condecimal(decimal_places=1, multiple_of=decimal.Decimal("0.5")) ` The work...
@gsakkis It may work if I use DecimalAnnotation, but then I can't specify the constraints I want in the Field() part of hte pydantic documentation. So, if I use the...