class ResearchDoc(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String())
    author = db.relationship('Author',
                             secondary=researchauthors,
                             backref=db.backref('researchdocs',
                                                lazy='dynamic'))
    date = db.Column(db.String())
    slug = db.Column(db.String())
    formats = db.relationship('Format',
                              secondary=researchformats,
                              backref=db.backref('researchdocs',
                                                 lazy='dynamic'))
    categories = db.relationship('Category',
                                 secondary=researchcategories,
                                 backref=db.backref('researchdocs',
                                                    lazy='dynamic'))
    doctype = db.Column(db.String())
    external = db.Column(db.String())
    lit_id = db.Column(db.Integer)

    def __repr__(self):
        return '<ResearchDoc %r>' % (self.title)

    @property
    def authors_string(self):
        return get_authors_string(self)
class BlogPostTranslation(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    blog_post_id = db.Column(db.Integer, db.ForeignKey('blog_post.id'))
    language_id = db.Column(db.Integer, db.ForeignKey('language.id'))
    blog_post = db.relationship("BlogPost", back_populates="translations")
    language = db.relationship("Language", back_populates="blog_posts")
    translators = db.relationship("Translator",
                                  secondary=blog_post_translators,
                                  back_populates="blog_posts")

    def __repr__(self):
        return '<BlogPostTranslation {} - {}>'.format(self.blog_post.slug,
                                                      self.language.ietf)
Beispiel #3
0
class BlogPost(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String())
    author = db.relationship('Author',
                             secondary=blogauthors,
                             backref=db.backref('blogposts', lazy='dynamic'))
    date = db.Column(db.Date)
    added = db.Column(db.Date)
    slug = db.Column(db.String())
    excerpt = db.Column(db.String())
    translations = db.relationship("BlogPostTranslation", back_populates="blog_post")
    series_id = db.Column(db.Integer, db.ForeignKey('blog_series.id'))
    series_index = db.Column(db.Integer)

    def __repr__(self):
        return '<BlogPost %r>' % (self.title)
Beispiel #4
0
class Language(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String())
    ietf = db.Column(db.String())
    blog_posts = db.relationship("BlogPostTranslation", back_populates="language")

    def __repr__(self):
        return '<Language %r>' % (self.ietf)
class Doc(db.Model):
 	id = db.Column(db.Integer, primary_key = True)
 	title = db.Column(db.String())
 	author = db.relationship('Author',
 		secondary = authors,
 		backref=db.backref('docs', lazy='dynamic'))
 	date = db.Column(db.String())
 	slug = db.Column(db.String())
 	formats = db.relationship('Format',
 		secondary = formats,
 		backref=db.backref('docs', lazy='dynamic'))
 	categories = db.relationship('Category',
 		secondary = categories,
 		backref=db.backref('docs', lazy='dynamic'))
 	doctype = db.Column(db.String())

 	def __repr__(self):
 		return '<Doc %r>' % (self.title)
class Email(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    satoshi_id = db.Column(db.Integer, unique=True)
    url = db.Column(db.String())
    subject = db.Column(db.String())
    sent_from = db.Column(db.String())
    date = db.Column(db.DateTime)
    text = db.Column(db.String())
    source = db.Column(db.String())
    source_id = db.Column(db.String())
    quotes = db.relationship("Quote", backref="email")
    parent_id = db.Column(db.Integer, db.ForeignKey('email.id'))
    replies = db.relationship('Email',
                              backref=db.backref('parent', remote_side=[id]),
                              lazy='dynamic')
    thread_id = db.Column(db.Integer, db.ForeignKey('email_thread.id'))

    def __repr__(self):
        return '<Email %r - %r>' % (self.subject, self.source_id)
class Translator(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String())
    url = db.Column(db.String())
    blog_posts = db.relationship("BlogPostTranslation",
                                 secondary=blog_post_translators,
                                 back_populates="translators")

    def __repr__(self):
        return '<Translator {}>'.format(self.name)
class BlogSeries(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String())
    slug = db.Column(db.String())
    blogposts = db.relationship("BlogPost", backref=db.backref('series'))

    def __str__(self):
        return self.title

    def __repr__(self):
        return '<BlogSeries %r>' % (self.title)
class Email(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    subject = db.Column(db.String())
    sent_from = db.Column(db.String())
    date = db.Column(db.DateTime)
    text = db.Column(db.String())
    source = db.Column(db.String())
    quotes = db.relationship("Quote", backref="email")

    def __repr__(self):
        return '<Email %r>' % (self.subject)
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    url = db.Column(db.String())
    name = db.Column(db.String())
    date = db.Column(db.DateTime)
    text = db.Column(db.String())
    source = db.Column(db.String())
    quotes = db.relationship("Quote", backref="post")

    def __repr__(self):
        return '<Post %r>' % (self.name)
class BlogPost(db.Model):
	id = db.Column(db.Integer, primary_key = True)
	title = db.Column(db.String())
	author = db.relationship('Author',
 		secondary = blogauthors,
 		backref=db.backref('blogposts', lazy='dynamic'))
	date = db.Column(db.Date)
	slug = db.Column(db.String())
	excerpt = db.Column(db.String())

	def __repr__(self):
 		return '<BlogPost %r>' % (self.title)
class Quote(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    text = db.Column(db.String())
    date = db.Column(db.Date)
    medium = db.Column(db.String())
    email_id = db.Column(db.Integer, db.ForeignKey('email.id'))
    post_id = db.Column(db.Integer, db.ForeignKey('post.satoshi_id'))
    categories = db.relationship('QuoteCategory',
                                 secondary=quote_categories,
                                 backref=db.backref('quotes', lazy='dynamic'))

    def __repr__(self):
        return '<Quote %r>' % (self.id)
class EmailThread(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String())
    source = db.Column(db.String())
    emails = db.relationship('Email', backref='email_thread', lazy=True)

    def source_to_string(self):
        if self.source == 'cryptography':
            return 'Cryptography Mailing List'
        else:
            return self.source

    def __repr__(self):
        return '<EmailThread %r>' % (self.title)
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    satoshi_id = db.Column(db.Integer, unique=True)
    url = db.Column(db.String())
    subject = db.Column(db.String())
    poster_name = db.Column(db.String())
    poster_url = db.Column(db.String())
    post_num = db.Column(db.Integer)  # Post number in thread
    is_displayed = db.Column(db.Boolean)
    nested_level = db.Column(db.Integer)
    date = db.Column(db.DateTime)
    text = db.Column(db.String())
    quotes = db.relationship("Quote", backref="post")
    thread_id = db.Column(db.Integer, db.ForeignKey('forum_thread.id'))

    def __repr__(self):
        return '<Post %r>' % (self.subject)
class ForumThread(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String())
    url = db.Column(db.String())
    source = db.Column(db.String())
    posts = db.relationship('Post', backref='forum_thread', lazy=True)

    def source_to_string(self):
        if self.source == 'bitcointalk':
            return 'BitcoinTalk'
        elif self.source == 'p2pfoundation':
            return 'P2P Foundation'
        else:
            return self.source

    def __repr__(self):
        return '<ForumThread %r>' % (self.title)