Esempio n. 1
0
class Story(BaseModel):
    hn_id = peewee.BigIntegerField(primary_key=True)
    next_post = peewee.DateField(default=_yesterday)
    first_saw = peewee.DateField(default=_today)
    last_saw = peewee.DateField(default=_today)
    times = peewee.IntegerField(default=1)
    position = peewee.IntegerField(default=0)
Esempio n. 2
0
class Job(peewee.Model):
    class Meta:
        database = db

    created = peewee.DateField(default=peewee.datetime.date.today())
    completed = peewee.DateField(null=True)
    info = peewee.CharField()
    part_of = peewee.ForeignKeyField('self', related_name="parts", null=True)
    category = peewee.ForeignKeyField(Category, related_name="jobs")
    room = peewee.ForeignKeyField(Room, related_name="jobs")

    def __str__(self):
        return "{} (id={})".format(self.info, self.id)

    def complete(self):
        """
        Helper to complete the current task. Uses the current date for the completion date.
        """
        self.completed = peewee.datetime.date.today()
        self.save()

    def complete_url(self):
        """
        Returns the URL for marking this task as completed.
        """
        return url_for('complete', id=self.id)

    def delete_url(self):
        return url_for('delete', id=self.id)
Esempio n. 3
0
class Equities(BaseModel):
    uuid = peewee.UUIDField(primary_key=True, unique=True)
    # 基本信息
    exchange = peewee.ForeignKeyField(Exchange, backref='equities',
                                      null=True)  # 所属市场
    market = peewee.ForeignKeyField(Market, backref='equities',
                                    null=True)  # 所属板块
    symbol = peewee.CharField(max_length=128)  # 股票代码
    name = peewee.CharField(max_length=64)  # 股票名称
    area = peewee.CharField(max_length=64, null=True)  # 所在地域
    industry = peewee.ForeignKeyField(ShenWanIndustry,
                                      backref='equities',
                                      null=True)
    list_status = peewee.CharField(max_length=16)  # 上市信息 L上市 D退市 P暂停上市
    list_date = peewee.DateField(null=True)  # 上市日期
    delist_date = peewee.DateField(null=True)  # 退市日期

    # 公司信息
    company = peewee.ForeignKeyField(Company, backref='equities',
                                     null=True)  # 公司详细信息
    company_name = peewee.CharField(max_length=128)  # 公司名称
    main_business = peewee.CharField(max_length=512)  # 主营业务
    telephone = peewee.CharField(max_length=64, null=True)  # 电话
    fax = peewee.CharField(max_length=64, null=True)  # 传真
    setup_date = peewee.DateField(null=True)  # 成立日期
    chairman = peewee.CharField(max_length=128, null=True)  # 法人代表
    manager = peewee.CharField(max_length=128, null=True)  # 总经理
    reg_capital = peewee.IntegerField(null=True)  # 注册资本(元)
Esempio n. 4
0
class Company(BaseModel):
    uuid = peewee.UUIDField(primary_key=True, unique=True)
    name = peewee.CharField(max_length=256)  # 公司名
    enname = peewee.CharField(max_length=256)  # 公司英文名
    market = peewee.CharField(max_length=128, null=True)  # 上市市场
    list_date = peewee.DateField(null=True)  # 上市日期
    init_price = peewee.CharField(max_length=128, null=True)  # 发行价格
    lead_underwriter = peewee.CharField(max_length=256, null=True)  # 主承销商
    create_date = peewee.DateField(null=True)  # 成立日期
    reg_capital = peewee.IntegerField(null=True)  # 注册资本(元)
    organization_type = peewee.CharField(max_length=128, null=True)  # 机构类型
    organization_form = peewee.CharField(max_length=128, null=True)  # 组织形式

    board_secretary = peewee.CharField(max_length=128, null=True)  # 董事会秘书
    board_secretary_telephone = peewee.CharField(max_length=128,
                                                 null=True)  # 董秘电话
    board_secretary_fax = peewee.CharField(max_length=128, null=True)  # 董秘传真
    board_secretary_mail = peewee.CharField(max_length=128,
                                            null=True)  # 董秘电子邮件

    company_telephone = peewee.CharField(max_length=128, null=True)  # 公司电话
    company_fax = peewee.CharField(max_length=128, null=True)  # 公司传真
    company_mail = peewee.CharField(max_length=128, null=True)  # 公司邮件
    company_website = peewee.CharField(max_length=128, null=True)  # 公司网站

    zip_code = peewee.CharField(max_length=64, null=True)  # 公司邮编
    register_address = peewee.CharField(max_length=256, null=True)  # 注册地址
    office_address = peewee.CharField(max_length=256, null=True)  # 办公地址
    description = peewee.TextField(null=True)  # 公司简介
    business_scope = peewee.TextField(null=True)  # 经营范围
Esempio n. 5
0
class ProjectTable(MySQLModel):
    name = pw.CharField(max_length=60, unique=True)
    description = pw.TextField()
    # Extra columns for datetime in charfield
    ext_date_start = pw.CharField()
    ext_date_end = pw.CharField()
    # Original date time fields
    date_start = pw.DateField()
    date_end = pw.DateField()
    # ---------------------------------
    created_at = pw.DateTimeField(default=datetime.datetime.now)
    modified_date = pw.DateTimeField(default=datetime.datetime.now)
    project_manager = pw.ForeignKeyField(User)

    def __init__(self, **kwargs):
        super(ProjectTable, self).__init__()
        self.name = kwargs.get('name')
        self.description = kwargs.get('description')
        # Extra columns for datetime in charfield
        self.ext_date_start = kwargs.get('date_start')
        self.ext_date_end = kwargs.get('date_end')
        # Original date time fields
        # self.ext_date_start = kwargs.get('date_start')
        # self.ext_date_end = kwargs.get('date_end')
        self.project_manager = kwargs.get('project_manager')
Esempio n. 6
0
class DailyRecord(BaseModel):
    title = pw.DateField(formats=['%Y-%m-%d'])
    completion_rate = pw.IntegerField(default=0)
    user = pw.ForeignKeyField(User,
                              backref="dailyrecords",
                              on_delete="CASCADE")
    date_created = pw.DateField(default=datetime.datetime.now().date())
Esempio n. 7
0
class Pub_Sku_Keyword(peewee.Model):
    id = peewee.IntegerField()
    title = peewee.CharField()
    platform = peewee.CharField()
    platform_id = peewee.IntegerField(default=0)
    status = peewee.CharField()
    sort = peewee.CharField()
    keyword_type = peewee.IntegerField(default=1)
    creator_id = peewee.IntegerField()
    updated_at = peewee.DateField(default=time.strftime("%Y-%m-%d %H:%M:%S"))
    created_at = peewee.DateField(default=time.strftime("%Y-%m-%d %H:%M:%S"))

    class Meta:
        database = pgDbClection().Conn()

    def keywordListAll(self):
        """
        获取全部记录
        :return: result list
        """
        try:
            rows = Pub_Sku_Keyword.select().order_by(Pub_Sku_Keyword.updated_at.desc()).dicts()
        except Exception as e:
            Log().error('查询数据失败')
            Log().error(e)

        return rows
Esempio n. 8
0
class Registro01(peewee.Model):
    data_pregao = peewee.DateField()
    codigo_bdi = peewee.CharField(max_length=2)
    codigo_negociacao = peewee.CharField(max_length=12)
    tipo_mercado = peewee.IntegerField()
    nome_resumido = peewee.CharField(max_length=12)
    especificaco = peewee.CharField(max_length=10)
    prazo_termo = peewee.CharField(max_length=3)
    moeda = peewee.CharField(max_length=4)
    preco_abertura = peewee.DecimalField(max_digits=11, decimal_places=2)
    preco_maximo = peewee.DecimalField(max_digits=11, decimal_places=2)
    preco_minimo = peewee.DecimalField(max_digits=11, decimal_places=2)
    preco_medio = peewee.DecimalField(max_digits=11, decimal_places=2)
    preco_ultimo = peewee.DecimalField(max_digits=11, decimal_places=2)
    preco_ofc = peewee.DecimalField(max_digits=11, decimal_places=2)
    preco_ofv = peewee.DecimalField(max_digits=11, decimal_places=2)
    total_negocios = peewee.IntegerField()
    quantidade_titulos = peewee.IntegerField()
    volume_titulos = peewee.DecimalField(max_digits=16, decimal_places=2)
    preexe = peewee.DecimalField(max_digits=11, decimal_places=2)
    indicador_cp = peewee.IntegerField()
    data_vencimento = peewee.DateField()
    fator_cotacao = peewee.IntegerField()
    ptoexe = peewee.DecimalField(max_digits=11, decimal_places=2)
    codigo_isin = peewee.CharField(max_length=12)
    dismes = peewee.IntegerField()

    class Meta:
        database = data_base
Esempio n. 9
0
class Job(BaseModel):
    """
    This class defines Job, which maintains details of past Jobs
    held by a Person.
    """
    logger.info("Defining table: Job.")
    logger.info("Adding job_name field to Job table.")
    job_name = pw.ForeignKeyField(DeptJobs)
    logger.info("Adding dept_name field to Job table.")
    dept_name = pw.ForeignKeyField(Department)
    logger.info("Adding start_date field to Job table.")
    start_date = pw.DateField(formats='YYYY-MM-DD', null=False)
    logger.info("Adding end_date field to Job table; default is current date.")
    end_date = pw.DateField(formats='YYYY-MM-DD', default=dt.date.today())
    logger.info("Add salary field to Job table.")
    salary = pw.DecimalField(max_digits=7, decimal_places=2)
    logger.info("Add person_employed field to Job table; the field is "
                "a foreign key from the Person table.")
    person_employed = pw.ForeignKeyField(Person,
                                         related_name='was_filled_by',
                                         null=False)

    class Meta:
        """This class defines a composite key as the primary key."""
        logger.info(
            "Set primary key to combo of person_employed & start_date fields.\n"
        )
        primary_key = pw.CompositeKey('person_employed', 'start_date')
Esempio n. 10
0
class UnionLottoExtendModel(BaseModel):
    # RESTRICT(限制外表中的外键改动)
    # CASCADE(跟随外键改动)
    # SET NULL(设空值)
    # SET DEFAULT(设默认值)
    # NO ACTION(无动作,默认的)
    issue = peewee.ForeignKeyField(UnionLottoModel,
                                   to_field='issue',
                                   on_delete='CASCADE',
                                   related_name='infos',
                                   primary_key=True)
    sale = peewee.IntegerField(verbose_name='本期销量', null=True)
    residue = peewee.IntegerField(verbose_name='奖池滚存', null=True)
    url = peewee.CharField(max_length=200, verbose_name='详情链接', null=True)

    lottery_dates = peewee.DateField(verbose_name='开奖日期', null=True)
    limite_dates = peewee.DateField(verbose_name='兑奖截止日期', null=True)

    prize_1_count = peewee.IntegerField(verbose_name='一等奖中奖注数', null=True)
    prize_2_count = peewee.IntegerField(verbose_name='二等奖中奖注数', null=True)
    prize_3_count = peewee.IntegerField(verbose_name='三等奖中奖注数', null=True)
    prize_4_count = peewee.IntegerField(verbose_name='四等奖中奖注数', null=True)
    prize_5_count = peewee.IntegerField(verbose_name='五等奖中奖注数', null=True)
    prize_6_count = peewee.IntegerField(verbose_name='六等奖中奖注数', null=True)

    prize_1_money = peewee.IntegerField(verbose_name='一等奖单注奖金(元)', null=True)
    prize_2_money = peewee.IntegerField(verbose_name='二等奖单注奖金(元)', null=True)
    prize_3_money = peewee.IntegerField(verbose_name='三等奖单注奖金(元)', null=True)
    prize_4_money = peewee.IntegerField(verbose_name='四等奖单注奖金(元)', null=True)
    prize_5_money = peewee.IntegerField(verbose_name='五等奖单注奖金(元)', null=True)
    prize_6_money = peewee.IntegerField(verbose_name='六等奖单注奖金(元)', null=True)
Esempio n. 11
0
class Metadatos(peewee.Model):
    class Meta:
        database = proxy
        indexes = ((('catalogo_id', 'dataset_id', 'distribucion_id',
                     'serie_id'), True), )

    catalogo_id = peewee.CharField(max_length=64)
    dataset_id = peewee.CharField(max_length=128)
    distribucion_id = peewee.CharField(max_length=128)
    serie_id = peewee.CharField(max_length=128, primary_key=True)

    indice_tiempo_frecuencia = peewee.CharField(max_length=8)
    serie_titulo = peewee.TextField()
    serie_unidades = peewee.TextField()
    serie_descripcion = peewee.TextField()

    distribucion_titulo = peewee.TextField()
    distribucion_descripcion = peewee.TextField()
    distribucion_url_descarga = peewee.TextField()

    dataset_responsable = peewee.TextField()
    dataset_fuente = peewee.TextField()
    dataset_titulo = peewee.TextField()
    dataset_descripcion = peewee.TextField()
    dataset_tema = peewee.TextField()

    serie_indice_inicio = peewee.DateField()
    serie_indice_final = peewee.DateField()
    serie_valores_cant = peewee.IntegerField(null=True)
    serie_dias_no_cubiertos = peewee.IntegerField(null=True)
    serie_actualizada = peewee.BooleanField()
    serie_valor_ultimo = peewee.FloatField(null=True)
    serie_valor_anterior = peewee.FloatField(null=True)
    serie_var_pct_anterior = peewee.FloatField(null=True)
    serie_discontinuada = peewee.BooleanField(null=True)
Esempio n. 12
0
class Benchmark(Model):
    author = peewee.CharField()
    author_url = peewee.CharField()
    date_submitted = peewee.DateField()
    date_updated = peewee.DateField()
    name = peewee.CharField(unique=True)
    summary = peewee.TextField()
    tags = peewee.CharField()
    title = peewee.CharField()
    url = peewee.CharField()

    @staticmethod
    def all():
        return Benchmark.select()

    @staticmethod
    def count():
        return Benchmark.select().count()

    @staticmethod
    def find_by_name(name):
        return Benchmark.select().where(Benchmark.name == name).first()

    @property
    def files(self):
        root = os.path.join(settings.DATA_ROOT, self.name)
        for dirpath, _, files in os.walk(root):
            for file in files:
                base, ext = os.path.splitext(file)
                if ext == '.m':
                    yield File(dirpath, base)
Esempio n. 13
0
class Job(BaseModel):
    """
    This class defines Job, which maintains details of past Jobs
    held by a Person.
    """
    logger.info('Now the Job class with a simlar approach')
    job_name = pw.CharField(primary_key=True, max_length=30)

    logger.info('Job Dates')
    start_date = pw.DateField(formats='YYYY-MM-DD')
    end_date = pw.DateField(formats='YYYY-MM-DD')

    logger.info('Job duration')
    duration_days = pw.IntegerField()

    logger.info('Job Number')
    salary = pw.DecimalField(max_digits=7, decimal_places=2)

    logger.info('Which person had the Job')
    person_employed = pw.ForeignKeyField(Person,
                                         related_name='was_filled_by',
                                         null=False)

    logger.info('Which department this job is in')
    job_dept = pw.ForeignKeyField(Department, backref='jobs')
Esempio n. 14
0
class Message(MySQLModel):
    id = peewee.PrimaryKeyField()
    id_reciver = peewee.IntegerField()
    description = peewee.CharField()
    date = peewee.DateField()
    date_buy = peewee.DateField()
    status = peewee.BooleanField()
    User = peewee.ForeignKeyField(rel_model=User, to_field=User.id)
Esempio n. 15
0
class Item(BaseModel):
    user = pw.ForeignKeyField(User, backref="item")
    title = pw.CharField(unique=True)
    description = pw.CharField(max_length=1000, null=True)
    category = pw.CharField()
    complete = pw.BooleanField(default=False)
    start_by = pw.DateField()
    completed_by = pw.DateField(null=True)
Esempio n. 16
0
    class Person(pw.Model):
        first_name = pw.CharField()
        last_name = pw.CharField(index=True)
        dob = pw.DateField(null=True)
        birthday = pw.DateField(default=dt.datetime.now)

        class Meta:
            order_by = ('-dob', )
Esempio n. 17
0
class AllFanInfo(BaseModel):
    fan_id = peewee.CharField(index=True)
    member = peewee.CharField()
    loyalty = peewee.FloatField()
    first_date = peewee.DateField(index=True)
    last_date = peewee.DateField(index=True)
    team = peewee.CharField()
    theater = peewee.CharField()
Esempio n. 18
0
class Quarter(BaseModel):
    start = peewee.DateField()
    end = peewee.DateField()

    neededNewAttribute = ['start', 'end']

    def jsonEncode(self):
        return {"id": self.id, "start": str(self.start), "end": str(self.end)}
Esempio n. 19
0
class Raid(Model):
    id = peewee.IntegerField(primary_key=True)
    name = peewee.TextField()
    clan_id = peewee.IntegerField()
    clan_name = peewee.TextField()
    summary = peewee.TextField(default="{}")
    start = peewee.DateField(default=date.today)
    end = peewee.DateField(null=True)
Esempio n. 20
0
class Fuentes(peewee.Model):
    class Meta:
        database = proxy

    fuente = peewee.TextField(primary_key=True)
    series_cant = peewee.IntegerField()
    valores_cant = peewee.IntegerField()
    fecha_primer_valor = peewee.DateField()
    fecha_ultimo_valor = peewee.DateField()
Esempio n. 21
0
class Capabilities(BaseModel):
    petani = pw.ForeignKeyField(Petani, related_name="capabilities")
    product = pw.ForeignKeyField(Product, related_name="capabilities")
    volume = pw.FloatField()
    start_date = pw.DateField()
    end_date = pw.DateField()

    class Meta:
        db_table = "capabilities"
Esempio n. 22
0
class User(BaseModel):
    username = pw.CharField(max_length=40, unique=True)  #base64 of sha512
    password = pw.FixedCharField(max_length=88)  #base64 of pbkdf2(sha512)
    salt = pw.FixedCharField(max_length=44)  #base64 of 32 byte salt
    email = pw.CharField(max_length=254, unique=True)
    registration_date = pw.DateField(default=date.today)
    activated = pw.BooleanField(default=False)
    secret = pw.FixedCharField(max_length=44)
    password_change_date = pw.DateField(default=date.today)
Esempio n. 23
0
class Tenure(BaseModel):
    uuid = peewee.UUIDField(primary_key=True, unique=True)
    person = peewee.ForeignKeyField(Person, backref='tenure')  # 高管
    company = peewee.ForeignKeyField(Company, backref='tenure')  # 任职公司
    position = peewee.CharField(max_length=64)  # 职务
    appointment_date = peewee.DateField(null=True)  # 任职日期
    departure_date = peewee.DateField(null=True)  # 离职日期
    remuneration = peewee.IntegerField(null=True)  # 报酬(元)
    period = peewee.IntegerField(null=True)  # 第几届
Esempio n. 24
0
class PasswordsLog(BaseModel):
    issuer = pw.ForeignKeyField(User)
    date = pw.DateTimeField(default=datetime.datetime.now)
    serial_number = pw.CharField(default='')
    version = pw.CharField(default='')

    date_from = pw.DateField(null=True)
    date_to = pw.DateField(null=True)
    days = pw.IntegerField()
Esempio n. 25
0
class History(BaseModel):
    """Data model for all checkout and return operations
    """
    OperationID = pw.PrimaryKeyField()
    user = pw.ForeignKeyField(user_manager.User, related_name='operations')
    copy = pw.ForeignKeyField(doc_manager.Copy, related_name='operations')
    librarian_co = pw.CharField()
    date_check_out = pw.DateField(formats='%Y-%m-%d')
    librarian_re = pw.CharField(null=True)
    date_return = pw.DateField(formats='%Y-%m-%d', null=True)
Esempio n. 26
0
class Birthday(pw.Model):
    """
    Birthday
    """
    user = pw.ForeignKeyField(User, primary_key=True)
    birth_date = pw.DateField()
    date_only = pw.BooleanField(default=False)
    last_check = pw.DateField(null=True)

    class Meta:
        database = database
Esempio n. 27
0
class Product(BaseModel):
    id = pw.AutoField(primary_key=True)
    name = pw.CharField(null=False)
    description = pw.TextField(null=True)
    image = pw.CharField(default="2.jpg")
    creation_date = pw.DateField(
        constraints=[pw.SQL('DEFAULT CURRENT_TIMESTAMP')])
    completion_date = pw.DateField(null=True)
    version = pw.CharField(null=True)
    creator_id = pw.ForeignKeyField(Client, backref="product_creator")
    manager_id = pw.ForeignKeyField(Client, backref="product_managed")
Esempio n. 28
0
class Course(BaseModel):
    name = orm.CharField(unique=True)
    assistent = orm.CharField()
    place = orm.TextField()
    type = orm.ForeignKeyField(TypeCourse, related_name='courses')
    init_date = orm.DateField()
    end_date = orm.DateField()
    proofs_file = orm.CharField(unique=True)

    def __str__(self):
        return "{} {}".format(self.name, self.place)
Esempio n. 29
0
class Booking(BaseModel):
    room = peewee.ForeignKeyField(Room,
                                  related_name='booking',
                                  on_delete='CASCADE')
    customer = peewee.ForeignKeyField(Customer,
                                      related_name='booking',
                                      on_delete='CASCADE')
    status = peewee.ForeignKeyField(Status)
    from_date = peewee.DateField(index=True)
    to_date = peewee.DateField(index=True)
    # TODO should move to separate table for discount and etc.
    cost = peewee.DecimalField()
Esempio n. 30
0
class FilePath(peewee.Model):
    f_name = peewee.ForeignKeyField(Name, backref="filepath")

    filepath = peewee.CharField()
    ctime = peewee.DateField()  # formats="%Y-%m-%dT%H:%M:%S"
    mtime = peewee.DateField()
    atime = peewee.DateField()
    size = peewee.IntegerField()

    class Meta:
        database = db
        db_table = "filepaths"  # file name to path,no repeat