예제 #1
0
class Poster(Table, tags=["special"]):
    """
    Has tags for tests which need it.
    """

    image = Bytea(default=b"\xbd\x78\xd8")
    content = Text()
예제 #2
0
class Post(Table):
    """
    A simple blog post.
    """

    title = Varchar()
    content = Text()
    published = Boolean(default=False)
    created_on = Timestamp()
예제 #3
0
class Movie(Table, db=DB):
    name = Varchar(length=300)
    rating = Real()
    duration = Integer()
    director = ForeignKey(references=Director)
    won_oscar = Boolean()
    description = Text()
    release_date = Timestamp()
    box_office = Numeric(digits=(5, 1))
예제 #4
0
class Review(Table):
    content = Text()
    created = Timestamp()
    review_grade = Integer()
    review_user = ForeignKey(references=User)
    ad = ForeignKey(references=Ad)

    @classmethod
    def get_readable(cls):
        return Readable(template="%s", columns=[cls.ad])
예제 #5
0
class Category(Table):
    """
    An Category table.
    """

    name = Varchar()
    description = Text()

    @classmethod
    def get_readable(cls):
        return Readable(template="%s", columns=[cls.name])
예제 #6
0
class Movie(Table):
    name = Varchar(length=300)
    rating = Real(help_text="The rating on IMDB.")
    duration = Interval()
    director = ForeignKey(references=Director)
    oscar_nominations = Integer()
    won_oscar = Boolean()
    description = Text()
    release_date = Timestamp()
    box_office = Numeric(digits=(5, 1), help_text="In millions of US dollars.")
    tags = Array(base_column=Varchar())
예제 #7
0
class Reply(Table):
    """
    An Reply table.
    """

    description = Text()
    created = Timestamp()
    topic = ForeignKey(references=Topic)
    reply_user = ForeignKey(references=BaseUser)

    @classmethod
    def get_readable(cls):
        return Readable(template="%s", columns=[cls.topic])
예제 #8
0
class Answer(Table):
    """
    An answer table.
    """

    content = Text()
    created_at = Timestamp()
    answer_like = Integer(default=0)
    is_accepted_answer = Boolean(default=False)
    ans_user = ForeignKey(references=User)
    question = ForeignKey(references=Question)

    @classmethod
    def get_readable(cls):
        return Readable(template="%s", columns=[cls.question])
예제 #9
0
class Ad(Table):
    title = Varchar(length=255)
    slug = Varchar(length=255)
    content = Text()
    created = Timestamp()
    view = Integer(default=0)
    price = Integer()
    room = Integer()
    visitor = Integer()
    address = Varchar(length=255)
    city = Varchar(length=255)
    ad_user = ForeignKey(references=User)

    @classmethod
    def get_readable(cls):
        return Readable(template="%s", columns=[cls.title])
예제 #10
0
class Question(Table):
    """
    An question table.
    """

    title = Varchar(length=200)
    slug = Varchar(length=200)
    description = Text()
    created_at = Timestamp()
    view = Integer(default=0)
    question_like = Integer(default=0)
    accepted_answer = Boolean(default=False)
    user = ForeignKey(references=User)
    category = ForeignKey(references=Category)

    @classmethod
    def get_readable(cls):
        return Readable(template="%s", columns=[cls.title])
예제 #11
0
class Movie(Table):
    class Genre(int, enum.Enum):
        fantasy = 1
        sci_fi = 2
        documentary = 3
        horror = 4
        action = 5
        comedy = 6
        romance = 7
        musical = 8

    name = Varchar(length=300)
    rating = Real(help_text="The rating on IMDB.")
    duration = Interval()
    director = ForeignKey(references=Director)
    oscar_nominations = Integer()
    won_oscar = Boolean()
    description = Text()
    release_date = Timestamp()
    box_office = Numeric(digits=(5, 1), help_text="In millions of US dollars.")
    tags = Array(base_column=Varchar())
    barcode = BigInt(default=0)
    genre = SmallInt(choices=Genre, null=True)
예제 #12
0
 class Band(Table):
     bio = Text()
예제 #13
0
파일: tables.py 프로젝트: zkan/piccolo
class Poster(Table, tags=["special"]):
    """
    Has tags for tests which need it.
    """

    content = Text()