Ejemplo n.º 1
0
class SmallGreyHeader(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    header = db.Column(db.String, nullable=False)
    order_smallgreyheader = db.Column(db.Integer)

    smallgreyheader_id = db.Column(db.Integer, db.ForeignKey(UniversalPage.id))
    smallgreyheader = db.relation(UniversalPage, backref='smallgreyheader')
Ejemplo n.º 2
0
class BlockQuote(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    header = db.Column(db.String, nullable=False)
    order_blockquote = db.Column(db.Integer)

    blockquote_id = db.Column(db.Integer, db.ForeignKey(UniversalPage.id))
    blockquote = db.relation(UniversalPage, backref='blockquote')
Ejemplo n.º 3
0
class WhiteHeaderWithButton(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    header_text = db.Column(db.String, nullable=False)
    button_text = db.Column(db.String, nullable=False)
    button_url = db.Column(db.String, nullable=False)
    order_whiteheaderwithbutton = db.Column(db.Integer)
    whiteheaderwithbutton_id = db.Column(db.Integer, db.ForeignKey(UniversalPage.id))
    whiteheaderwithbutton = db.relationship(UniversalPage, backref='whiteheaderwithbutton')
Ejemplo n.º 4
0
class Faq(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    question = db.Column(db.String, nullable=False)
    answer = db.Column(db.Text, nullable=False)
    order_faq = db.Column(db.Integer)

    faq_id = db.Column(db.Integer, db.ForeignKey(UniversalPage.id))
    faq = db.relation(UniversalPage, backref='faq')
Ejemplo n.º 5
0
class BlockQuoteWithHeader(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    header_text = db.Column(db.Text, nullable=False)
    paragraph_text = db.Column(db.Text, nullable=False)
    order_blockquotewithheader = db.Column(db.Integer)

    blockquotewithheader_id = db.Column(db.Integer, db.ForeignKey(UniversalPage.id))
    blockquotewithheader = db.relation(UniversalPage, backref='blockquotewithheader')
Ejemplo n.º 6
0
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    content = db.Column(db.Text, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)  # user id that authors the post

    # how object is printed
    def __repr__(self):
        return f"Post('{self.title}', '{self.date_posted}')"
Ejemplo n.º 7
0
class ThreeColumnsWithHeaders(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    column_no_1_header = db.Column(db.String, nullable=False)
    column_no_1_text = db.Column(db.Text, nullable=False)
    column_no_2_header = db.Column(db.String, nullable=False)
    column_no_2_text = db.Column(db.Text, nullable=False)
    column_no_3_header = db.Column(db.String, nullable=False)
    column_no_3_text = db.Column(db.Text, nullable=False)
    order_threecolumnswithheaders = db.Column(db.Integer)

    threecolumnswithheaders_id = db.Column(db.Integer, db.ForeignKey(UniversalPage.id))
    threecolumnswithheaders = db.relation(UniversalPage, backref='threecolumnswithheaders')
Ejemplo n.º 8
0
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    intro = db.Column(db.String(200))
    body = db.Column(db.Text(), nullable=False)
    timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow)

    user_name = db.Column(db.Integer, db.ForeignKey('user.username'))
    user = db.relationship("User", back_populates="posts")

    @property
    def slugified_title(self):
        return slugify(self.title)

    def __repr__(self):
        return 'Post {}'.format(self.title)
Ejemplo n.º 9
0
from datetime import datetime

from flask_login import UserMixin
from flask_security import RoleMixin

from flask_site import db

users_roles = db.Table(
    'users_roles',
    db.Column('user_id', db.Integer(), db.ForeignKey('user.id')),
    db.Column('role_id', db.Integer(), db.ForeignKey('role.id'))
)


class Role(db.Model, RoleMixin):
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(30), unique=True, nullable=False)
    description = db.Column(db.String(300))

    def __repr__(self):
        return self.name


class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), unique=True)
    email = db.Column(db.String(120), unique=True)
    password = db.Column(db.String(128))
    about_me = db.Column(db.String(10000))
    created = db.Column(db.DateTime, default=datetime.utcnow())
    firstname = db.Column(db.String(50))