예제 #1
0
class Reservation(MongoModel):
    _id = fields.ObjectIdField(primary_key=True, default=ObjectId())
    check_in = fields.DateTimeField()
    check_out = fields.DateTimeField()
    adults = fields.IntegerField()
    children = fields.IntegerField()
    room_inventory_id = fields.ObjectIdField()
    first_name = fields.CharField()
    last_name = fields.CharField()
    email = fields.CharField()
    phone = fields.CharField()
    message = fields.CharField()
    conf_number = fields.CharField(default='undefined')
    status = fields.CharField(choices=('pending', 'confirmed', 'cancelled'), default='pending')
    created_at = fields.DateTimeField()
    updated_at = fields.DateTimeField(default=datetime.utcnow())

    @staticmethod
    def find_reservation(id):
        return Reservation.objects.get({"_id": ObjectId(id)})
예제 #2
0
class BuyAndSell(MongoModel):
    # Category name will be in soon
    item_name = fields.CharField()
    description = fields.CharField()
    img = fields.CharField()
    date = fields.DateTimeField(default=fields.datetime.datetime.now())
    user = fields.ReferenceField(User, on_delete=fields.ReferenceField.CASCADE)

    class Meta:
        connection_alias = "uknow"
        write_concern = WriteConcern(j=True)
class Summary(EmbeddedMongoModel):
    last_fill_date = fields.DateTimeField()
    total_fills = fields.IntegerField()
    total_gallons_used = fields.IntegerField()
    tank_size = fields.IntegerField()
    current_available = fields.FloatField()
    avg_day = fields.FloatField()
    min_day = fields.FloatField()
    max_day = fields.FloatField()
    min_week = fields.FloatField()
    current_monthly_usage = fields.FloatField()
예제 #4
0
class VerificationCode(MongoModel):
    user_id = fields.ReferenceField(User, required=True)
    code = fields.CharField(required=True)
    create_at = fields.DateTimeField(required=True, default=get_timestamp)

    class Meta:
        indexes = [
            pymongo.IndexModel([('user_id', pymongo.ASCENDING)]),
            pymongo.IndexModel([('create_at', pymongo.ASCENDING)],
                               expireAfterSeconds=conf['expire_time'])
        ]
예제 #5
0
파일: models.py 프로젝트: newsgac/platform
class Article(MongoModel):
    raw_text = fields.CharField()
    date = fields.DateTimeField()
    year = fields.IntegerField()
    label = fields.IntegerField()
    source = fields.CharField()
    page = fields.IntegerField()
    urls = fields.ListField(fields.CharField())

    class Meta:
        ignore_unknown_fields = True
예제 #6
0
class AIPRecord(MongoModel):
    """ 定投记录 """
    exchange = fields.CharField()
    coin_pair = fields.CharField()
    date = fields.DateTimeField()
    cost = fields.FloatField()
    amount = fields.FloatField()

    class Meta:
        connection_alias = DB_POSITION
        connection_name = CN_AIP_RECORDS
예제 #7
0
class Message(MongoModel):
    url = fields.CharField()
    text = fields.CharField()
    date = fields.DateTimeField()
    channel = fields.CharField()
    tags = fields.ListField()
    salary = fields.DictField()

    class Meta:
        write_concern = WriteConcern(j=True)
        connection_alias = 'Messages'
예제 #8
0
class PromocionModel(MongoModel):
    # nombre = fields.CharField()
    titulo = fields.CharField()
    tipo = fields.CharField()
    valor = fields.FloatField()
    productos_validos = fields.ListField(fields.CharField(), default=[])
    puntos = fields.FloatField()
    sellos = fields.IntegerField()
    descripcion = fields.CharField()
    descuento_porciento = fields.FloatField()
    descuento_pesos = fields.FloatField()
    descuento_producto = fields.FloatField()
    descuento_categoria = fields.CharField()
    fecha_creacion = fields.DateTimeField()
    fecha_vigencia = fields.DateTimeField()
    fecha_redencion = fields.DateTimeField()
    imagen_miniatura = fields.CharField()
    imagen_display = fields.CharField()
    codigo_barras = fields.CharField()
    codigo_qr = fields.CharField()
예제 #9
0
class CheckinToStudent(MongoModel):
    student_id = fields.ReferenceField(User, required=True)
    checkin_id = fields.ReferenceField(Checkin, required=True)
    status = fields.BooleanField()
    create_at = fields.DateTimeField(required=True, default=get_timestamp)

    class Meta:
        indexes = [
            pymongo.IndexModel([('student_id', pymongo.ASCENDING)]),
            pymongo.IndexModel([('checkin_id', pymongo.ASCENDING)]),
        ]
class Patient(MongoModel):
    """
    Data Class used by MongoDB
    """
    patient_id = fields.IntegerField(primary_key=True)
    attending_email = fields.EmailField()
    user_age = fields.IntegerField()
    last_heart_rate = fields.IntegerField()
    last_timestamp = fields.DateTimeField()
    heart_rates = fields.ListField()
    timestamps = fields.ListField()
예제 #11
0
class Appointments(MongoModel):
    # appointment_id=fields.IntegerField()
    providerId = fields.IntegerField()
    patientId = fields.IntegerField()
    date = fields.DateTimeField()
    status = fields.CharField(choices=('PENDING', 'SCHEDULED', 'ONGOING'),
                              default="PENDING")

    class Meta:
        collection_name = 'Appointments'
        final = True
예제 #12
0
class Comments(MongoModel):
    author_id = fields.ReferenceField(User, required=True)
    author_name = fields.CharField(required=True, blank=False)
    post_id = fields.ReferenceField(Content, required=True)
    comment = fields.CharField(required=True, blank=False)
    create_at = fields.DateTimeField(required=True, default=get_timestamp)

    class Meta:
        indexes = [
            pymongo.IndexModel([('post_id', pymongo.ASCENDING)]),
            pymongo.IndexModel([('author', pymongo.ASCENDING)])
        ]
예제 #13
0
class BodyWeight(MongoModel):

    value_lbs = fields.FloatField(mongo_name='lbs', required=True)
    time = fields.DateTimeField(required=True)

    @property
    def value(self):
        return self.value_lbs * ureg.pound

    class Meta:
        connection_alias = 'health-connection'
        collection_name = 'body_weight'
예제 #14
0
class Token(MongoModel):
    jti = fields.CharField()
    token = fields.CharField()
    token_type = fields.CharField()
    creation = fields.DateTimeField()
    expiration = fields.DateTimeField()
    last_access = fields.DateTimeField()
    IP = fields.CharField()
    # no longer used
    hostname = fields.CharField(blank=True)
    location = fields.CharField(blank=True)
    user_id = fields.ReferenceField(User, blank=True)

    class Meta:
        # write_concern = WriteConcern(j=True)
        connection_alias = AUTH_DB

        indexes = [
            IndexModel("jti", unique=True),
            IndexModel("token", unique=True)
        ]
예제 #15
0
class Survey(MongoModel):
    user_id = fields.ReferenceField(User, required=True)
    course_id = fields.ReferenceField(Course, required=True)
    title = fields.CharField(required=True, default='')
    content = fields.CharField(required=True, default='')
    create_at = fields.DateTimeField(required=True, default=get_timestamp)

    class Meta:
        indexes = [
            pymongo.IndexModel([('user_id', pymongo.ASCENDING)]),
            pymongo.IndexModel([('course_id', pymongo.ASCENDING)])
        ]
예제 #16
0
class Decision(MongoModel):
    time = fields.DateTimeField(required=True)
    product_id = fields.CharField(required=True, choices=products_list)
    decision = fields.CharField(required=True, choices=('Buy', 'Sell', 'Wait'))
    strategy = fields.CharField(required=True)
    order_book = fields.EmbeddedDocumentField(OrderBook, required=False)

    objects = DecisionManager()

    class Meta:
        final = True
        indexes = [IndexModel([('product_id', 1), ('time', -1)])]
예제 #17
0
class Trade(MongoModel):
    trade_id = fields.IntegerField(min_value=0)
    time = fields.DateTimeField(required=True)
    product_id = fields.CharField(required=True, choices=products_list)
    size = fields.FloatField(required=True)
    price = fields.FloatField(required=True)
    side = fields.CharField(required=True, choices=('buy', 'sell'))
    ticker_data = fields.EmbeddedDocumentField(TickerData, required=False)

    class Meta:
        final = True
        indexes = [IndexModel([('product_id', 1), ('time', -1)])]
예제 #18
0
class Emails(MongoModel):
    userEmail = fields.EmailField()
    msgid = fields.IntegerField()
    efrom = fields.EmailField()
    eto = fields.EmailField(blank=True)
    subject = fields.CharField(
        max_length=100, blank=True
    )  # max_length=100 to store just the beginning of the subject
    internaldate = fields.DateTimeField()
    content = fields.CharField()
    charset = fields.CharField()
    flags = fields.CharField()
예제 #19
0
class Insurance(BaseAccount):
    sumAssured = fields.CharField()
    tenure = fields.CharField()
    premiumDate = fields.DateTimeField()
    startDate = fields.DateTimeField()
    maturityDate = fields.DateTimeField()
    frequency = fields.CharField()
    policyType = fields.CharField()
    premiumPaymentTerm = fields.IntergerField()
    policyName = fields.CharField()
    bonus = fields.FloatField()
    maturityBenefit = fields.FloatField()

    def populate(self):
        print("Adding Insurance Account")
        self.name = input("Name: ")
        self.balance = 0.0
        self.description = input("Description: ")
        self.sumAssured = 0.0
        self.tenure = 0.0
        self.frequency = 0.0
예제 #20
0
class Reminder(MongoModel):
    origin = fields.CharField(required=True)
    order_number = fields.CharField(required=True)
    order_ID = fields.CharField(required=True)
    item_ID = fields.CharField(blank=True)
    email = fields.EmailField(required=True)
    product_desc = fields.CharField(blank=True)
    project_title = fields.CharField(blank=True)
    url = fields.CharField(required=True)
    notification = fields.IntegerField(required=True, choices=[0, 1, 2, 3])
    status = fields.IntegerField(required=True, choices=[0, 1, 2, 3])
    createdAt = fields.DateTimeField(required=True)
예제 #21
0
class Data(MongoModel):
    idData = fields.IntegerField(primary_key=True)
    filename = fields.CharField(max_length=255)
    isClean = fields.BooleanField(default=False)
    dateUploaded = fields.DateTimeField()

    # tweetStartID = fields.IntegerField()
    # tweetEndID = fields.IntegerField()

    class Meta:
        write_concern = WriteConcern(j=True)
        connection_alias = 'athenaDB'
예제 #22
0
class Image(MongoModel):
    name = fields.CharField(primary_key=True)
    filename = fields.CharField()
    extension = fields.CharField()
    image = fields.CharField()
    uploadedAt = fields.DateTimeField()
    user = fields.ReferenceField(User)

    objects = ImageManager()

    class Meta:
        connection_alias = 'bme547-db'
예제 #23
0
class AIMSPosition(Position):
    """ AIMS 策略仓位 """
    # 仓位更新日期
    update_date = fields.DateTimeField()

    def update(self, increase_cost, increase_hold):
        self.update_date = datetime.now()
        super().update(increase_cost, increase_hold)

    class Meta:
        connection_alias = DB_POSITION
        collection_name = CN_AIMS_POS
예제 #24
0
class ClassificationProject(MongoModel):
    _id = fields.CharField(primary_key=True, required=True, default=uuid.uuid4)
    user = fields.ReferenceField(User, required=True)
    name = fields.CharField(required=True, blank=False)
    created = fields.DateTimeField(required=True,
                                   default=datetime.datetime.now)
    description = fields.CharField()
    classes = fields.EmbeddedDocumentListField(ClassData, default=[])
    training_instances = fields.EmbeddedDocumentListField(TrainingInstance,
                                                          default=[])
    data_gathering_runs = fields.EmbeddedDocumentListField(GatheringRun,
                                                           default=[])
예제 #25
0
class NotedMedia(MongoModel):
    # because primary_key is True, we will need to query this
    # field using the label _id
    media_id = fields.CharField(primary_key=True)
    media_src = fields.URLField()
    media_title = fields.CharField()
    media_img = fields.URLField()
    # email = fields.EmailField()
    ts_start = fields.ListField(field=fields.FloatField())
    ts_end = fields.ListField(field=fields.FloatField())
    body = fields.ListField(field=fields.CharField())
    ts_insert = fields.ListField(field=fields.DateTimeField())
예제 #26
0
class ChannelAdmin(EmbeddedMongoModel):
    uid = fields.ReferenceField(User, on_delete=fields.ReferenceField.CASCADE, verbose_name='user_id',
                                mongo_name='userId', required=True)
    admin_since = fields.DateTimeField(verbose_name='admin_since', mongo_name='adminJoinDate', required=True)
    can_post = fields.BooleanField(verbose_name='admin_can_post', mongo_name='adminCanPost',
                                   default=True)
    can_edit_others = fields.BooleanField(verbose_name='admin_can_edit_others', mongo_name='adminCanEditOthers',
                                          default=False)
    can_delete_others = fields.BooleanField(verbose_name='admin_can_delete_others', mongo_name='adminCanDeleteOthers',
                                            default=False)
    can_update_channel_info = fields.BooleanField(verbose_name='admin_can_update_channel_info',
                                                  mongo_name='adminCanUpdateChannelInfo', default=False)
예제 #27
0
class MDBConfig(EmbeddedMongoModel):
    class Meta:
        final = True
        connection_alias = "photon_core"

    photon_config_id = fields.CharField(blank=True)
    inner_folds = fields.EmbeddedDocumentListField(MDBInnerFold, default=[], blank=True)
    best_config_score = fields.EmbeddedDocumentField(MDBInnerFold, blank=True)
    computation_start_time = fields.DateTimeField(blank=True)
    computation_end_time = fields.DateTimeField(blank=True)
    fit_duration_minutes = fields.IntegerField(blank=True)
    pipe_name = fields.CharField(blank=True)
    config_dict = fields.DictField(blank=True)
    children_config_dict = fields.DictField(blank=True)
    children_config_ref = fields.ListField(default=[], blank=True)
    # best_config_ref_to_train_item = fields.CharField(blank=True)
    config_nr = fields.IntegerField(blank=True)
    config_failed = fields.BooleanField(default=False)
    config_error = fields.CharField(blank=True)
    full_model_spec = fields.DictField(blank=True)
    metrics_train = fields.EmbeddedDocumentListField(
        MDBFoldMetric, default=[], blank=True
    )
    metrics_test = fields.EmbeddedDocumentListField(
        MDBFoldMetric, default=[], blank=True
    )
    human_readable_config = fields.DictField(blank=True)

    def set_photon_id(self):
        self.photon_config_id = str(uuid.uuid4())

    def save_memory(self):
        for fold in self.inner_folds:
            fold.training.y_true = []
            fold.training.y_pred = []
            fold.training.indices = []
            fold.validation.y_true = []
            fold.validation.y_pred = []
            fold.validation.indices = []
            fold.feature_importances = []
예제 #28
0
class MatchInfo(MongoModel):
    Name = fields.CharField(required=True, blank=False)
    FirstTeamName = fields.CharField(required=True, blank=False)
    SecondTeamName = fields.CharField(required=True, blank=False)
    Date = fields.DateTimeField(required=True, blank=False)
    CreateTime = fields.DateTimeField(required=True, blank=False)
    Ratios = fields.EmbeddedDocumentListField(MatchRatioInfo,
                                              default=[],
                                              blank=True)
    WebSiteMachId = fields.CharField()
    LeageInfo = fields.ReferenceField(LeageInfo, required=True)
    Hour = fields.CharField(required=True, blank=False)
    UniqueKey = fields.CharField(required=True, blank=False)
    #WebSiteInfo = fields.ReferenceField(WebSiteInfo, required=True)

    # Verileri yazdırmak için kullanılan fonksiyon
    @property
    def print(self):
        print("Maç Adı : " + str(self.Name))
        print("İlk Takım Adı : " + str(self.FirstTeamName))
        print("İkinci Takım Adı : " + str(self.SecondTeamName))
        print("Tarihi : " + str(self.Date))
예제 #29
0
class Transaction(MongoModel):
    fields_to_serialize = ('card_number', 'miles', 'flying_from', 'flying_to',
                           'flying_date')

    card_number = fields.CharField()
    # Начисленные бонусы
    bonus = fields.FloatField(default=0)
    # полет откуда
    flying_from = fields.CharField()
    # Полет куда
    flying_to = fields.CharField()
    # дата полёта
    flying_date = fields.DateTimeField()
예제 #30
0
class Entry(MongoModel):
    amount = fields.FloatField()
    debitAccount = fields.ReferenceField(BaseAccount)
    creditAccount = fields.ReferenceField(BaseAccount)
    dateTime = fields.DateTimeField()
    description = fields.CharField()
    debitAccountBalance = fields.FloatField()
    creditAccountBalance = fields.FloatField()

    class Meta:
        write_concern = WriteConcern(j=True)
        connection_alias = CONFIG.CONN_NAME
        collection_name = CONFIG.TRX_COLL_NAME