Пример #1
0
 def __setattr__(self, key, value):
     if key not in self._fields:
         if isinstance(value, basestring):
             self._fields[key] = StringField()
         elif isinstance(value, int):
             self._fields[key] = IntegerField()
         else:
             self._fields[key] = StringField(_multi=True)
     super(Doc, self).__setattr__(key, value)
Пример #2
0
 class Address(Document):
     _doctype = "doc_type"
     _index = "index"
     _es = MockES()
     _validators = [if_city_state_is_required]
     street = StringField(validators=[max_len_10])
     number = IntegerField(required=True)
     city = StringField()
     state = StringField()
Пример #3
0
class DW(D):
    _es = ES()
    id = IntegerField()  # ID hould be inherited
    document_id = StringField()
    house_number = IntegerField()
    height = FloatField()
Пример #4
0
class D(Document):
    _index = _INDEX
    _doctype = _DOC_TYPE
    id = IntegerField()
Пример #5
0
class TowFields(EmbeddedDocument):
        x = IntegerField()
        y = IntegerField()