Beispiel #1
0
class Document(db.TimeStampedBase):
    owner = db.ForeignKey(kind=Member)
    logo = db.Binary()
    template = db.ForeignKey(kind=Template)
    name = db.String()
    injections = db.JSON()
    assembly = db.JSON()
    declarations = db.JSON()
    pdf = db.String()
    revision = db.Integer(default=0)
    signup_sheet = db.Boolean(default=True)
    table_of_contents = db.Boolean(default=True)
    declaration_page = db.Boolean(default=True)
    pretty_filenames = db.Boolean(default=True)
    section_page_breaks = db.Boolean(default=False)

    def summary(self):
        d = {
            "key": self.id(),
            "name": self.name,
            "revision": self.revision,
            "pdf": self.pdf,
            "created": str(self.created)[:19],
            "modified": str(self.modified)[:19],
            "declarations": self.declarations or {}
        }
        if self.template:
            t = self.template.get()
            d["template"] = {"key": t.id(), "name": t.name}
        return d

    def content(self, sections=None):
        return self.template.get().content(
            sections, page_breaks=self.section_page_breaks)
Beispiel #2
0
class Section(SecBase):
    image = db.Binary()
    headerless = db.Boolean(default=False)

    def labeler(self):
        return "%s [%s]" % (self.name, self.index)

    def header(self):
        return self.headerless and " " or self.name

    def desc(self, depth=0, novars=False):
        d = self.fixed_desc(depth, novars)
        if not self.image:
            return d
        return "%s\r\n\r\n![](%s)" % (d, symage(self.image.path))
Beispiel #3
0
class Table(db.TimeStampedBase):
    name = db.String()
    csv = db.Binary()
Beispiel #4
0
class Photo(db.TimeStampedBase):
    img = db.Binary()
    caption = db.String()
    label = "caption"
Beispiel #5
0
class VideoPost(BasePost):  # rename this, simplify code, migrate old dbs?
    video = db.Binary()
    poster = db.Binary()
Beispiel #6
0
class Post(BasePost):
    img = db.Binary()
    body = db.Text()
Beispiel #7
0
class Image(db.TimeStampedBase):
    image = db.Binary()
    link = db.String()
Beispiel #8
0
class Media(LibItem):
    item = db.Binary()
    kind = db.String(choices=["img", "video", "audio", "pdf"])