コード例 #1
0
ファイル: models.py プロジェクト: 1571906645/blog
class Sonart(db.Model):
    __tablename__ = 'sonart'
    id = db.Column(db.Integer, primary_key=True)
    text = db.Column(db.String(255))
    viewtime = db.Column(db.DateTime)
    uid = db.Column(db.Integer, db.ForeignKey('user.id'))
    fid = db.Column(db.Integer, db.ForeignKey('fatherart.id'))
    user = db.relationship('User', backref=db.backref('sonart'))
    fatherart = db.relationship('Fatherart', backref=db.backref('sonart'))

    def __repr__(self):
        return "<id %r>" % self.id
コード例 #2
0
class CallLogs(db.Model):
    """ 통화기록 테이블 """
    __tablename__ = 'call_logs'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    name = db.Column(db.String(40), nullable=False)  # 저장된 이름
    log_type = db.Column(db.Enum('IN', 'OUT', 'MISS', 'UNKNOWN'),
                         nullable=False)  # 종류 : 수신, 발신, 부재중, 알수없음
    phone = db.Column(db.String(40), nullable=False)  # 전번
    time = db.Column(db.String(40), nullable=False)  # 통화시간 얼마나 했는지
    created_at = db.Column(db.String(40), nullable=False)  # 전화를 한 시간

    user = db.relationship('Users')

    def get_call_log_object(self):
        call_log = {
            'id': self.id,
            'uid': self.uid,
            'name': self.name,
            'log_type': self.log_type,
            'phone': self.phone,
            'time': self.time,
            'created_at': self.created_at
        }
        call_log['shop_name'] = self.user.name

        return call_log
コード例 #3
0
ファイル: models.py プロジェクト: 1571906645/blog
class New(db.Model):
    __tablename__ = 'new'
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(255))
    text = db.Column(db.Text)
    cover = db.Column(db.String(255))
    clicknum = db.Column(db.Integer)
    comnum = db.Column(db.Integer)
    createtime = db.Column(db.DateTime)
    altertime = db.Column(db.DateTime)
    uid = db.Column(db.Integer, db.ForeignKey('user.id'))
    tid = db.Column(db.Integer, db.ForeignKey('type.id'))
    user = db.relationship('User', backref=db.backref('new'))
    type = db.relationship('Type', backref=db.backref('new'))

    def __repr__(self):
        return "<id %r>" % self.id
コード例 #4
0
ファイル: admins.py プロジェクト: zio4272/search
class Admins(db.Model):
    """ 관리자 테이블 """
    __tablename__ = 'admins'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.now)

    def get_admin_object(self):
        admin = {
            'id': self.id,
            'uid': self.uid,
            'created_at': str(self.created_at)
        }

        return admin
コード例 #5
0
class Contacts(db.Model):
    """ 연락처 테이블 """
    __tablename__ = 'contacts'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    phone = db.Column(db.String(40), nullable=False)  # 전번
    name = db.Column(db.String(40), nullable=False)  # 저장된 이름
    created_at = db.Column(db.String(40), nullable=False)  #저장된 날짜

    user = db.relationship('Users')

    def get_contact_object(self):
        contact = {
            'id': self.id,
            'uid': self.uid,
            'phone': self.phone,
            'name': self.name,
            'created_at': self.created_at
        }
        contact['shop_name'] = self.user.name
        return contact
コード例 #6
0
class Periods(db.Model):
    """ 결제관련 테이블 """
    __tablename__ = 'periods'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    start = db.Column(db.String(40), nullable=False) # 시작일
    end = db.Column(db.String(40), nullable=False) # 종료일
    created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.now) # 생성날짜
    updated_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.now) # 생성날짜

    def get_period_object(self):
        period = {
            'id': self.id,
            'uid': self.uid,
            'start': self.start,
            'end': self.end,
            'created_at': str(self.created_at),
            'updated_at': str(self.updated_at)
        }

        return period
コード例 #7
0
class Notices(db.Model):
    """ 공지사항 테이블 """
    __tablename__ = 'notices'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.Integer, db.ForeignKey('users.id'),
                    nullable=False)  #작성자
    title = db.Column(db.String(40), nullable=False)  # 제목
    content = db.Column(db.Text, nullable=False)  # 내용
    created_at = db.Column(db.DateTime,
                           nullable=False,
                           default=datetime.datetime.now)  # 생성날짜

    def get_notice_object(self):
        notice = {
            'id': self.id,
            'uid': self.uid,
            'title': self.title,
            'content': self.content,
            'created_at': str(self.created_at)
        }

        return notice
コード例 #8
0
class Messages(db.Model):
    """ 메시지 테이블 """
    __tablename__ = 'messages'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    phone = db.Column(db.String(40), nullable=False)  # 전화번호 or 이름
    content = db.Column(db.Text, nullable=False)  # 메시지 내용
    type = db.Column(db.Enum('IN', 'OUT'), nullable=False)  # 종류 : 수신, 발신, 부재중
    created_at = db.Column(db.String(40), nullable=False)  # 날짜

    user = db.relationship('Users')

    def get_message_object(self):
        message = {
            'id': self.id,
            'uid': self.uid,
            'phone': self.phone,
            'content': self.content,
            'type': self.type,
            'created_at': self.created_at
        }
        message['shop_name'] = self.user.name
        return message