octabytes / FireO

Google Cloud Firestore modern and simplest convenient ORM package in Python. FireO is specifically designed for the Google's Firestore
https://fireo.octabyte.io
Apache License 2.0
250 stars 29 forks source link

refix issue #48: field_attribute validation #50

Closed jackcvr closed 4 years ago

jackcvr commented 4 years ago

Previous fix does not always work.

For example when NumberField has range attribute:

class Person(Model):
    name = fields.TextField(required=True)
    type = fields.NumberField(required=True, int_only=True, range=(1, 2))

person = Person.collection.create(name="test", type=1)
person.name = "test2"
person.update()  # TypeError: '<' not supported between instances of 'NoneType' and 'int'