Пример #1
0
class Unidades_Privadas(Document):
    PROPIEDAD_ID = fields.LazyReferenceField('Propiedades_Horizontales',
                                             passthrough=False,
                                             dbref=False)
    IDENTIFICADOR = fields.StringField(required=True)
    GRUPO = fields.StringField(required=True)
    MATRICULA_INMOBILIARIA = fields.StringField(required=True)
    AREA_PRIVADA = fields.FloatField()
    AREA_COMUN = fields.FloatField()
    AREA_CONSTRUIDA = fields.FloatField()
    ESTADO_UNIDAD = fields.StringField(required=True)
    HABITACIONES = fields.IntField()
    BAÑOS = fields.IntField()
    CANTIDAD_PARQUEADEROS = fields.IntField()
    MAXIMO_AUTOS = fields.IntField()
    MAXIMO_MOTOS = fields.IntField()
    COEFICIENTE_COPROPIEDAD = fields.FloatField()
    ESTADO_CARTERA = fields.StringField()
    RESIDENTES = fields.ListField(fields.EmbeddedDocumentField(ResidenteField))
    PARQUEADEROS = fields.ListField(fields.StringField())
    VEHICULOS_PERMANENTES = fields.ListField(
        fields.EmbeddedDocumentField(VehiculoPermanenteField))
    VEHICULOS_TEMPORALES = fields.ListField(
        fields.EmbeddedDocumentField(VehiculoTemporalField))
    PROPIETARIO = fields.EmbeddedDocumentField(PropietarioField)
    ESTADO_CUENTA = fields.EmbeddedDocumentField(EstadoCuentaField)
    HABILITADO = fields.BooleanField()
Пример #2
0
class Place(gj.Document):
    title = fields.StringField(required=True,
                               max_length=70,
                               unique_with='address')
    main_category = fields.StringField(max_length=30, choices=src.categories)
    categories = fields.ListField(fields.StringField(max_length=30,
                                                     choices=src.categories),
                                  default=[])
    main_cuisine = fields.StringField(max_length=30, choices=src.cuisines)
    cuisines = fields.ListField(fields.StringField(max_length=30,
                                                   choices=src.cuisines),
                                default=[])
    additional_services = fields.ListField(fields.StringField(
        max_length=30, choices=src.additional_services),
                                           default=[])
    description = fields.StringField(max_length=3000)
    phone = fields.StringField(required=True, max_length=20, unique=True)
    instagram = fields.URLField()
    website = fields.URLField()
    timezone = fields.StringField(required=True)
    opening_hours = fields.ListField(field=fields.ListField(
        field=fields.DateTimeField(default=datetime.utcnow), max_length=2),
                                     max_length=7,
                                     default=[[None, None]] * 7)
    address = fields.EmbeddedDocumentField(Address, required=True)
    main_photo = fields.ReferenceField(Image, reverse_delete_rule=NULLIFY)
    photos = fields.ListField(fields.ReferenceField(Image,
                                                    reverse_delete_rule=PULL),
                              default=[])
    general_review = fields.ReferenceField(GeneralReview,
                                           reverse_delete_rule=NULLIFY,
                                           unique=True)
    configuration = fields.EmbeddedDocumentField(Configuration)
    is_active = fields.BooleanField(default=False)
Пример #3
0
class Goods(Document):
    source = fields.StringField(max_length=50)
    goods_id = fields.StringField(max_length=64)
    goods_url = fields.StringField(max_length=1024, unique=True)
    title = fields.StringField(max_length=1024)
    goods_type = fields.StringField(max_length=50)
    country = fields.StringField(max_length=100)
    link = fields.StringField(max_length=1024)
    mobile_link = fields.StringField(max_length=1024)
    image_link = fields.StringField(max_length=1024)
    images = fields.ListField(fields.StringField(max_length=1024))
    availability = fields.StringField(max_length=100)
    availability_date = fields.StringField(max_length=100)
    price = fields.StringField(max_length=100)
    sale_price = fields.FloatField()
    sale_price_effective_date = fields.StringField(max_length=100)
    brand = fields.StringField(max_length=100)
    material = fields.StringField(max_length=100)
    pattern = fields.StringField(max_length=100)
    shipping = fields.StringField(max_length=100)
    shipping_weight = fields.StringField(max_length=100)
    shipping_label = fields.StringField(max_length=100)
    multipack = fields.StringField(max_length=100)
    sku = fields.ListField(fields.EmbeddedDocumentField(Sku))
    specs = fields.ListField(fields.EmbeddedDocumentField(Specs))
    description = fields.StringField(max_length=1024)
    offer = fields.DateTimeField(Offer)
    price_history = fields.ListField(
        fields.EmbeddedDocumentField(PriceHistory))
    pub_date = fields.DateTimeField(default=datetime.datetime.now)
Пример #4
0
class DeepDoc(Document):
    f_list = fields.ListField(fields.IntField())
    f_map = fields.MapField(fields.IntField())
    f_dict = fields.DictField()

    f_emb = fields.EmbeddedDocumentField(EmbDoc)
    f_emblist = fields.ListField(fields.EmbeddedDocumentField(EmbDoc))
Пример #5
0
class Player(Document):
    name = fields.StringField(required=True, null=False)
    photo_url = fields.StringField(required=True, null=True)
    positions = fields.ListField(fields.StringField(required=True, null=True))
    age = fields.StringField(required=True)
    birth_date = fields.StringField(required=True)
    height = fields.IntField(required=True)
    weight = fields.IntField(required=True)
    overall_rating = fields.IntField(required=True)
    potential = fields.IntField(required=True)
    value = fields.StringField(required=True)
    wage = fields.StringField(required=True)
    preferred_foot = fields.StringField(required=True)
    international_reputation = fields.IntField(required=True)
    weak_foot = fields.IntField(required=True)
    skill_moves = fields.IntField(required=True)
    work_rate = fields.StringField(required=True)
    body_type = fields.StringField(required=True)
    real_face = fields.StringField(required=True)
    release_clause = fields.StringField(default='0')
    player_hashtags = fields.ListField(
        fields.StringField(required=True, null=True))
    social = fields.EmbeddedDocumentField(PlayerSocial)
    skills = fields.EmbeddedDocumentField(PlayerSkills)
    player_traits = fields.ListField(fields.StringField(null=True), null=True)
Пример #6
0
class Metadata(fields.EmbeddedDocument):
    kernelspec = fields.EmbeddedDocumentField(Kernelspec,
                                              required=True,
                                              help_text='kernelspec',
                                              default=Kernelspec)
    language_info = fields.EmbeddedDocumentField(LanguageInfo,
                                                 required=True,
                                                 help_text='language info',
                                                 default=LanguageInfo)
Пример #7
0
class Task(Document):
    name = fields.StringField(max_length=2000, primary_key=True)
    job_type = fields.StringField(max_length=100)
    updated = fields.DateTimeField()
    failures_count = fields.IntField()

    prep = fields.EmbeddedDocumentField(Prep)
    workflow = fields.EmbeddedDocumentField(Workflow)
    statuses = fields.EmbeddedDocumentListField(TaskSiteStatus)
class Member(Document):
    creation_datetime = fields.DateTimeField(default=Utils().now())
    email = fields.EmailField()
    entrance_list = fields.ListField(
        field=fields.EmbeddedDocumentField(Entrance))
    first_name = fields.StringField()
    last_name = fields.StringField()
    # registration_number = fields.IntField(required=True)
    subscription_list = fields.ListField(
        fields.EmbeddedDocumentField(Subscription))
Пример #9
0
class Rule(Document):
    name = fields.StringField(max_length=100, default=None)
    consequence = fields.EmbeddedDocumentField(RuleConsequence)
    conditions = fields.ListField(fields.EmbeddedDocumentField(RuleCondition))
    active = fields.BooleanField(default=True)
    original = fields.BooleanField(default=True)
    benefit = fields.BooleanField(default=False)
    redeemable = fields.BooleanField(default=False)
    redeemed_by = fields.ListField(fields.ReferenceField(User))
    cost = fields.IntField(default=0)
Пример #10
0
class Article(Document):
    title = fields.StringField(unique=True)
    text = fields.StringField()
    comments = fields.ListField(fields.EmbeddedDocumentField(Comment))
    top_comment = fields.EmbeddedDocumentField(Comment)
    tags = fields.ListField(fields.StringField())
    publish = fields.BooleanField()
    publish_date = fields.DateTimeField()
    version = fields.FloatField()
    order = fields.IntField()
    serial_number = fields.LongField()
Пример #11
0
class Presentacion(EmbeddedDocument):
    nombre = fields.StringField(required=True, max_length=35)
    precio_compra = fields.FloatField(required=True)
    precio_venta = fields.FloatField(required=True)
    lotes = fields.ListField(fields.EmbeddedDocumentField(Lote), required=True)
    medidas = fields.EmbeddedDocumentField(Medidas)
    detalle_unitario = fields.ListField(
        fields.EmbeddedDocumentField(DetalleUnitario))

    def __str__(self):
        return self.nombre
Пример #12
0
class JobPosition(Document):
    location = fields.EmbeddedDocumentField(Location)
    company_size = fields.IntField(min_value=0)
    experience_level = fields.StringField(max_length=100)
    technologies = fields.ListField(fields.StringField())
    finances = fields.EmbeddedDocumentField(Finances)
    date = fields.StringField(max_length=100)

    meta = {'allow_inheritance': True}

    def __str__(self):
        return self.title
Пример #13
0
 class Person(Document):
     name = f.StringField()
     age = f.IntField(default=30)
     coffee = f.IntField(db_field='s', default=5)
     fav_nums = f.ListField(f.IntField())
     userid = f.StringField()
     friends = f.ListField(f.ReferenceField('Person'))
     wildcard = f.ListField(f.GenericReferenceField())
     best_friend = f.ReferenceField('Person')
     best_blob = f.GenericReferenceField()
     thought = f.EmbeddedDocumentField('Thought')
     other_thoughts = f.ListField(f.EmbeddedDocumentField('Thought'))
     other_attrs = f.DictField()
Пример #14
0
class Photo(Document):
    photoId = fields.StringField(unique=True)
    filename = fields.StringField()
    userId = fields.StringField()
    tag = fields.EmbeddedDocumentField(Tag)
    gps = fields.EmbeddedDocumentField(GeoData)
    createTime = fields.DateTimeField()  # 拍照的時間
    updateTime = fields.DateTimeField(default=datetime.utcnow())
    isDeleted = fields.BooleanField(default=False)

    @classmethod
    def pre_save(cls, sender, document):
        document.lastUpdateTime = datetime.utcnow()
Пример #15
0
class Metadata(EmbeddedDocument):
    calculated = fields.BooleanField(default=False)
    eff_vs_layer_thickness = fields.EmbeddedDocumentField(Plot)
    eff_vs_bslayer_thickness = fields.EmbeddedDocumentField(Plot)
    eff_vs_tslayer_thickness = fields.EmbeddedDocumentField(Plot)
    eff_vs_wavelength = fields.EmbeddedDocumentField(Plot)
    eff_vs_wavelength_bs = fields.EmbeddedDocumentField(Plot)
    eff_vs_wavelength_ts = fields.EmbeddedDocumentField(Plot)
    total_efficiency = fields.DecimalField(null=True, default=0)
    phs_alpha_06 = fields.EmbeddedDocumentField(Plot)
    phs_alpha_94 = fields.EmbeddedDocumentField(Plot)
    phs_li_06 = fields.EmbeddedDocumentField(Plot)
    phs_li_94 = fields.EmbeddedDocumentField(Plot)
Пример #16
0
class User(Document):
    userId = fields.StringField(unique=True)
    expiresAt = fields.DateTimeField()
    refreshToken = fields.StringField()
    lastUpdateTime = fields.DateTimeField(default=datetime.utcnow())
    lastSync = fields.DateTimeField()
    isSync = fields.BooleanField(default=False)
    isFreshing = fields.BooleanField(default=False)
    color_onto = fields.EmbeddedDocumentField(Onto, default=Onto())
    people_onto = fields.EmbeddedDocumentField(Onto, default=Onto())

    @classmethod
    def pre_save(cls, sender, document):
        document.lastUpdateTime = datetime.utcnow()
Пример #17
0
class User(Document):
    name = fields.StringField(required=True)
    profession = fields.StringField()
    email = fields.EmailField()
    phone = fields.StringField()
    website = fields.URLField()
    github = fields.StringField()
    summary = fields.StringField()
    skills = fields.ListField(fields.StringField())
    career = fields.ListField(fields.EmbeddedDocumentField(Job))
    education = fields.ListField(fields.EmbeddedDocumentField(Degree))

    def __str__(self):
        return self.name
Пример #18
0
class Job(Document):
    code = fields.StringField(required=True)
    date = fields.DateTimeField(required=True)
    role = fields.StringField(required=True)
    title = fields.StringField(required=True)
    company = fields.EmbeddedDocumentField(Company)
    previewImg = fields.StringField(null=True)
    wage = fields.EmbeddedDocumentField(Wage)
    opening = fields.StringField(null=True)
    regions = fields.ListField(fields.StringField())
    types = fields.ListField(fields.StringField())
    labels = fields.ListField(fields.StringField())
    content = fields.EmbeddedDocumentField(Content)
    source = fields.EmbeddedDocumentField(Source)
    meta = {'alias': 'default', 'collection': 'job'}
Пример #19
0
class Cuenta_Cobro(Document):
    UNIDAD_PRIVADA = fields.EmbeddedDocumentField(UnidadPrivadaField)
    PERIODO = fields.StringField(required=True)
    CONSECUTIVO = fields.StringField(required=True)    
    FECHA_CUENTA_COBRO = fields.DateTimeField(default=datetime.datetime.utcnow)
    PERIODO_COBRO = fields.EmbeddedDocumentField(PeriodoCobroField)
    ELEMENTOS = fields.ListField(fields.EmbeddedDocumentField(ElementoField))
    INTERESES_CAUSADOS = fields.FloatField()
    SALDO_INTERESES = fields.FloatField()
    SALDO_CAPITAL = fields.FloatField()
    VALOR_TOTAL = fields.FloatField()
    PROPIEDAD_HORIZONTAL = fields.EmbeddedDocumentField(PropiedadHorizontalField)
    COMPROBANTE = fields.EmbeddedDocumentField(ComprobanteField)
    DOCUMENTO = fields.FileField()
    HABILITADO = fields.BooleanField()
Пример #20
0
class Metric(Document):
    """
    key:
        address IP
    """
    version = fields.IntField(default=0)

    internal_field = fields.IntField(default=0)

    group_name = fields.StringField(required=True,
                                    max_length=80,
                                    default=constants.GROUP_DEFAULT)

    date = fields.DateTimeField(required=True)

    key = fields.StringField(required=True)

    key_type = fields.IntField(choices=constants.METRIC_KEY_TYPE_CHOICES,
                               default=constants.METRIC_KEY_TYPE_GROUP)

    metrics = fields.EmbeddedDocumentField(MetricKeys)

    meta = {
        'collection': 'metric',
        'indexes': ['group_name', 'key', 'key_type', 'metrics'],
        'ordering': ['-date']  #, 'key_type', 'key']
    }
Пример #21
0
class InvoicingSettings(EmbeddedDocument):
    """A wrapper to Invoicing's module settings."""
    TAXES_APPLICATION = TAXES_APPLICATION
    PAYMENT_TYPES = PAYMENT_TYPES
    PAYMENT_CONDITIONS = PAYMENT_CONDITIONS

    supported_currencies = fields.ListField(fields.ReferenceField("Currency"))
    default_currency = fields.ReferenceField("Currency", required=True)
    fy_start_month = fields.IntField(required=True,
                                     default=0,
                                     min_value=0,
                                     max_value=11)
    inv_taxes_application = fields.StringField(required=True,
                                               choices=TAXES_APPLICATION,
                                               default="EXCLUSIVE")
    quotation_validity = fields.IntField(required=True, default=30)
    payment_conditions = fields.StringField(required=True,
                                            choices=PAYMENT_CONDITIONS,
                                            default="CASH")
    custom_payment_conditions = fields.StringField()
    accepted_payment_types = fields.ListField(
        fields.StringField(choices=PAYMENT_TYPES),
        required=True,
        default=lambda: ["CHECK", "CASH", "CREDIT_CARD", "TRANSFER"])
    late_fee_rate = fields.DecimalField()
    down_payment_percent = fields.DecimalField(required=True,
                                               default=lambda: Decimal("0"))
    automatic_reminders = fields.BooleanField(required=True, default=False)
    automatic_reminders_text = fields.StringField(max_length=1024)
    automatic_reminders_send_copy = fields.BooleanField(required=True,
                                                        default=True)
    numbering = fields.EmbeddedDocumentField(
        "InvoicingNumberingSettings",
        required=True,
        default=lambda: InvoicingNumberingSettings())
Пример #22
0
class Professional(User):

    specialties = fields.ListField(fields.ReferenceField(Specialty,
                                                         required=True),
                                   required=True)
    insurances = fields.ListField(fields.ReferenceField(Insurance,
                                                        required=True),
                                  required=True)
    rating = fields.IntField(min_value=0, max_value=5)
    address = fields.EmbeddedDocumentField(Address, required=True)

    def to_dict(self):
        result = super(Professional, self).to_dict()
        result['address'] = self.address.to_dict()
        result['rating'] = self.rating
        result['specialties'] = []
        for specialty in self.specialties:
            result['specialties'].append(specialty.to_dict())
        result['insurances'] = []
        for insurance in self.insurances:
            result['insurances'].append(insurance.to_dict())
        return result

    def get_role(self):
        return 'professional'

    @classmethod
    def get_all(cls):
        result = []
        for professional in cls.objects:
            result.append(professional.to_dict())
        return result
Пример #23
0
class Feed(Document):
    sender = fields.StringField(default="", required=True)
    datetime = fields.DateTimeField(default=datetime.datetime.now(),
                                    required=True)
    priority = fields.DecimalField(default=0, required=True)
    description = fields.StringField(default="", required=True)
    others = fields.ListField(fields.EmbeddedDocumentField(OtherInput))
Пример #24
0
class BasicStructure(EmbeddedDocument):
    main_tag = fields.EmbeddedDocumentListField(ATag)
    color = fields.EmbeddedDocumentListField(ColorModel)
    people = fields.EmbeddedDocumentField(PeopleTag, default=PeopleTag())
    location = fields.ListField()
    emotion_tag = fields.StringField(default="")
    deduction = fields.ListField()
Пример #25
0
class Article(DocumentMixin, DynamicDocument):
    meta = {"collection": "articles", "indexes": ["ID", "category.ID"]}

    ID = fields.IntField()

    title = fields.StringField()
    alias = fields.StringField()

    category = fields.EmbeddedDocumentField(Category, null=True)

    created = fields.DateTimeField(null=True)
    updated = fields.DateTimeField(null=True)

    @classmethod
    def from_instance(cls, instance):

        if instance.category is not None:
            category = Category.from_instance(instance.category)
        else:
            category = None

        return cls(
            ID=instance.id,
            title=instance.title,
            alias=instance.alias,
            created=instance.created,
            updated=instance.updated,
            category=category,
        )
Пример #26
0
class Notebooks(Document):
    nbformat = fields.IntField(required=True, help_text="nbformat version")
    nbformat_minor = fields.IntField(required=True,
                                     help_text="nbformat minor version")
    metadata = fields.EmbeddedDocumentField(Metadata,
                                            required=True,
                                            help_text='notebook metadata',
                                            default=Metadata)
    cells = fields.EmbeddedDocumentListField(Cell,
                                             required=True,
                                             help_text='cells')
    meta = {'collection': 'notebooks'}

    problem_key = 'application/vnd.plotly.v1+json'
    escaped_key = problem_key.replace('.', '~dot~')

    def transform(self, incoming=True):
        if incoming:
            old_key = self.problem_key
            new_key = self.escaped_key
        else:
            old_key = self.escaped_key
            new_key = self.problem_key

        for cell in self.cells:
            for output in cell.outputs:
                if old_key in output.get('data', {}):
                    output['data'][new_key] = output['data'].pop(old_key)

    def clean(self):
        self.transform()

    def restore(self):
        self.transform(incoming=False)
Пример #27
0
 class Schema1EmbDoc1(EmbeddedDocument):
     embdoc1_int = fields.IntField()
     embdoc1_str = fields.StringField()
     embdoc1_str_empty = fields.StringField()
     embdoc1_str_ten = fields.StringField(choices=[str(x) for x in range(11)])
     embdoc1_float = fields.FloatField()
     embdoc1_int_empty = fields.IntField()
     embdoc1_long = fields.LongField()
     embdoc1_decimal = fields.DecimalField()
     embdoc1_complex_datetime = fields.ComplexDateTimeField()
     embdoc1_list = fields.ListField()
     embdoc1_ref_doc1 = fields.ReferenceField('Schema1Doc1')
     embdoc1_emb_embdoc1 = fields.EmbeddedDocumentField('self')
     embdoc1_emblist_embdoc1 = fields.EmbeddedDocumentListField('self')
     embdoc1_emb_embdoc2 = fields.EmbeddedDocumentField('Schema1EmbDoc2')
     embdoc1_emblist_embdoc2 = fields.EmbeddedDocumentListField('Schema1EmbDoc2')
Пример #28
0
class Role(Document, MongoMixin):
    meta = {
        'indexes': [],
        'allow_inheritance': False,
        'db_alias': 'iu-demo',
        'force_insert': True,
    }

    name = f.StringField(primary_key=True)
    description = f.StringField()
    parents = f.ListField(f.StringField())
    permissions = f.ListField(f.EmbeddedDocumentField('Permission'))

    def get_permissions(self):
        plist = list(self.permissions)
        parents = Role.objects.filter(name__in=self.parents)
        for r in parents:
            permissions = r.get_permissions()
            for p in permissions:
                if p not in plist:
                    plist.append(p)
        return plist

    def to_json_dict(self, fields=None):
        ret = {
            'name': self.name,
            'description': self.description,
            'parents': [str(p) for p in self.parents],
            'permissions': [p.to_json_dict() for p in self.permissions],
            'permissions_all':
            [p.to_json_dict() for p in self.get_permissions()]
        }
        if fields is not None:
            ret = {k: v for k, v in ret.items() if k in fields}
        return ret
Пример #29
0
class ContactPoint(fields.EmbeddedDocument):
    system = fields.StringField(
        choices=model_types.CONTACT_POINT_SYSTEM_TYPES.items())
    value = fields.StringField(max_length=150)
    use = fields.StringField(
        choices=model_types.CONTACT_POINT_USE_TYPES.items())
    period = fields.EmbeddedDocumentField(Period)
Пример #30
0
class Location(Document):
    """
    A location object
    """
    name = fields.StringField()
    description = fields.StringField()
    address = fields.StringField()
    lat = fields.StringField()
    lng = fields.StringField()
    submitted_by = fields.StringField()
    certified = fields.BooleanField()
    feature_set = fields.EmbeddedDocumentField(FeatureSet,
                                               default=FeatureSet())
    comments = fields.EmbeddedDocumentListField(Comment)

    def __repr__(self):  # pragma: no cover
        return "Location(name=%r)" % self.name

    def toJSType(self):
        """
        => dict of Location
        """
        return dict(name=self.name,
                    description=self.description,
                    address=self.address,
                    lat=self.lat,
                    lng=self.lng,
                    submitted_by=self.submitted_by,
                    certified=self.certified,
                    id=str(self.id),
                    comments=[c.toJSType() for c in self.comments],
                    feature_set=self.feature_set.toJSType())