Пример #1
0
class SchematicsFieldsModel(BaseModel):
    # base fields
    type_string = types.StringType()
    type_int = types.IntType()
    type_uuid = types.UUIDType()
    type_IPv4 = types.IPv4Type()
    type_url = types.URLType()
    type_email = types.EmailType()
    type_number = types.NumberType(int, "integer")
    type_int = types.IntType()
    type_long = types.LongType()
    type_float = types.FloatType()
    type_decimal = types.DecimalType()
    type_md5 = types.MD5Type()
    type_sha1 = types.SHA1Type()
    type_boolean = types.BooleanType()
    type_date = types.DateType()
    type_datetime = types.DateTimeType()
    type_geopoint = types.GeoPointType()
    # type_multilingualstring = types.MultilingualStringType(default_locale='localized_value')

    # compound fields
    type_list = compound.ListType(types.StringType)
    type_dict = compound.DictType(
        types.IntType)  # dict values can be only integers
    type_list_of_dict = compound.ListType(compound.DictType,
                                          compound_field=types.StringType)
    type_dict_of_list = compound.DictType(compound.ListType,
                                          compound_field=types.IntType)
    type_model = compound.ModelType(NestedModel)
    type_list_model = compound.ListType(compound.ModelType(NestedModel))

    # reference fields
    type_ref_simplemodel = ModelReferenceType(SimpleModel)
    type_ref_usermodel = ModelReferenceType(User)

    class Options:
        # namespace = 'st'
        collection = 'st'
        serialize_when_none = False
Пример #2
0
class Topic(BaseModel):
    title = types.StringType(default='best')
    ancestor = ModelReferenceType('self')

    class Options:
        indexes = ({'fields': 'title', 'unique': True}, )
Пример #3
0
class RecordSeries(BaseModel):
    title = types.StringType()
    records = compound.ListType(ModelReferenceType(Record))
    simplies = compound.ListType(ModelReferenceType(SimpleModel))
    main_event = ModelReferenceType(Event)
Пример #4
0
class Record(BaseModel):
    title = types.StringType()
    event = ModelReferenceType(Event)
    simple = ModelReferenceType(SimpleModel)
Пример #5
0
class Event(BaseModel):
    title = types.StringType()
    user = ModelReferenceType(User)

    class Options:
        indexes = ({'fields': ('title', 'user.name')}, )
Пример #6
0
class ParentBase(BaseModel):
    friends = compound.ListType(
        ModelReferenceType(ChildB, reverse_delete_rule=PULL))
Пример #7
0
class ParentSublcassed(ParentBase):
    guru = ModelReferenceType(ChildC, reverse_delete_rule=NULLIFY)
Пример #8
0
class ParentMixin(Model):
    """
    Need to subclass schematics.Model, so declared fields will be collected
    """
    friends = compound.ListType(
        ModelReferenceType(ChildB, reverse_delete_rule=PULL))
Пример #9
0
class ParentK(BaseModel, ParentMixin):
    guru = ModelReferenceType(ChildC, reverse_delete_rule=NULLIFY)
Пример #10
0
class ParentG(BaseModel):
    childs = compound.ListType(
        ModelReferenceType(ChildA, reverse_delete_rule=CASCADE))
Пример #11
0
class ParentI(BaseModel):
    childs = compound.ListType(
        ModelReferenceType(ChildA, reverse_delete_rule=PULL))
Пример #12
0
class ParentE(BaseModel):
    childs = compound.ListType(
        ModelReferenceType(ChildA, reverse_delete_rule=DO_NOTHING))
Пример #13
0
class ParentD(BaseModel):
    child = ModelReferenceType(ChildA, reverse_delete_rule=DENY)
Пример #14
0
class ParentC(BaseModel):
    child = ModelReferenceType(ChildA, reverse_delete_rule=CASCADE)
Пример #15
0
class ParentB(BaseModel):
    child = ModelReferenceType(ChildA, reverse_delete_rule=NULLIFY)
Пример #16
0
class ParentA(BaseModel):
    child = ModelReferenceType(ChildA, reverse_delete_rule=DO_NOTHING)