示例#1
0
def create_connection_model(service):
    """ Create an SQL Alchemy table that connects the provides services """
    # the services connected
    services = service._services

    # the mixins / base for the model
    bases = (BaseModel,)
    # the fields of the derived
    attributes = {model_service_name(service): fields.CharField() for service in services}

    # create an instance of base model with the right attributes
    return type(BaseModel)(connection_service_name(service), bases, attributes)
示例#2
0
class User(BaseModel):
    email = fields.CharField()
示例#3
0
 def test_serialize_native_type(self):
     # make sure it converts a native string to 'String'
     import nautilus.models.fields as fields
     assert serialize_native_type(fields.CharField()) == 'String', (
         "Could not serialize native type.")
示例#4
0
 def test_can_convert_CharField(self):
     self.assert_field_converted(nautilus.CharField(), graphene.String)
示例#5
0
class UserPassword(HasPassword, BaseModel):
    user = fields.CharField(unique=True) # points to a remote user entry
示例#6
0
class Ingredient(BaseModel):
    name = fields.CharField()
示例#7
0
class Recipe(BaseModel):
    name = fields.CharField()
    category = fields.CharField()
    cook_time = fields.IntegerField()