我们从Python开源项目中,提取了以下45个代码示例,用于说明如何使用google.appengine.ext.ndb.IntegerProperty()。
def query_purchase_with_customer_key(): # [START purchase_with_customer_key_models] class Customer(ndb.Model): name = ndb.StringProperty() class Purchase(ndb.Model): customer = ndb.KeyProperty(kind=Customer) price = ndb.IntegerProperty() # [END purchase_with_customer_key_models] def query_purchases_for_customer_via_key(customer_entity): purchases = Purchase.query( Purchase.customer == customer_entity.key).fetch() return purchases return Customer, Purchase, query_purchases_for_customer_via_key
def query_purchase_with_ancestor_key(): # [START purchase_with_ancestor_key_models] class Customer(ndb.Model): name = ndb.StringProperty() class Purchase(ndb.Model): price = ndb.IntegerProperty() # [END purchase_with_ancestor_key_models] def create_purchase_for_customer_with_ancestor(customer_entity): purchase = Purchase(parent=customer_entity.key) return purchase def query_for_purchases_of_customer_with_ancestor(customer_entity): purchases = Purchase.query(ancestor=customer_entity.key).fetch() return purchases return (Customer, Purchase, create_purchase_for_customer_with_ancestor, query_for_purchases_of_customer_with_ancestor)
def get_IntegerField(kwargs): """ Returns an ``IntegerField``, applying the ``ndb.IntegerProperty`` range limits. """ v = validators.NumberRange(min=-0x8000000000000000, max=0x7fffffffffffffff) kwargs['validators'].append(v) return f.IntegerField(**kwargs)
def convert_IntegerProperty(self, model, prop, kwargs): """Returns a form field for a ``ndb.IntegerProperty``.""" if prop._repeated: return IntegerListPropertyField(**kwargs) return get_IntegerField(kwargs)
def testIntProperty_shouldConvertToString(self): self.__assert_conversion(ndb.IntegerProperty, graphene.Int)