예제 #1
0
class Partner(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False)
    description = db.Column(db.Text, nullable=False)
    image = db.Column(db.String(20), nullable=False, default='default.jpg')

    def __repr__(self):
        return f"Partner('{self.name}', '{self.description}')"
예제 #2
0
class History(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    header = db.Column(db.String(50), nullable=False)
    description = db.Column(db.Text, nullable=False)
    date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    image = db.Column(db.String(20), nullable=False, default='default.jpg')

    def __repr__(self):
        return f"History('{self.header}', '{self.description}', '{self.datetime}')"
예제 #3
0
class NewsComment(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(50), nullable=False)
    email = db.Column(db.String(30), nullable=False)
    message = db.Column(db.Text, nullable=False)
    datetime = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    news_id = db.Column(db.Integer, db.ForeignKey('news.id'), nullable=False)

    def __repr__(self):
        return f"NewsComment('{self.username}', '{self.email}', '{self.datetime}', '{self.message}')"
예제 #4
0
class Callback(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(50), nullable=False)
    email = db.Column(db.String(30), nullable=False)
    phone = db.Column(db.String(13))
    subject = db.Column(db.String(60), nullable=False)
    message = db.Column(db.Text, nullable=False)
    datetime = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)

    def __repr__(self):
        return f"Callback('{self.username}', '{self.email}', '{self.subject}', '{self.message}', '{self.datetime}')"
예제 #5
0
class News(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    header = db.Column(db.String(70), nullable=False)
    description = db.Column(db.Text, nullable=False)
    date_posted = db.Column(db.DateTime,
                            nullable=False,
                            default=datetime.utcnow)
    image = db.Column(db.String(20), nullable=False, default='default.jpg')
    text = db.Column(db.Text, nullable=False)
    category_id = db.Column(db.Integer, db.ForeignKey('news_category.id'))
    comments = db.relationship('NewsComment', backref='news', lazy=True)

    def __repr__(self):
        return f"News('{self.header}', '{self.description}', '{self.date_posted}')"
예제 #6
0
class Project(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(70), nullable=False)
    image = db.Column(db.String(20), nullable=False, default='default.jpg')
    description = db.Column(db.Text, nullable=False)
    authors = db.Column(db.String(180), nullable=False)
    url = db.Column(db.String(70))
    year = db.Column(db.Enum(Years), default=Years.FIRST)
    semester = db.Column(db.Enum(Semesters), default=Semesters.FIRST)
    pictures = db.relationship('ProjectPicture',
                               backref='project',
                               lazy=True,
                               cascade='all, delete')

    def __repr__(self):
        return f"Project('{self.title}', '{self.description}', '{self.authors}', '{self.year}','{self.semester}')"
예제 #7
0
class ProjectPicture(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    image = db.Column(db.String(20), nullable=False, default='default.jpg')
    project_id = db.Column(db.Integer,
                           db.ForeignKey('project.id'),
                           nullable=False)

    def __repr__(self):
        return f"ProjectPicture('{self.id}', '{self.project_id}')"
예제 #8
0
class PageText(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    primary_text = db.Column(db.Text)
    image = db.Column(db.String(20))
    secondary_text = db.Column(db.Text)
    position = db.Column(db.Integer, nullable=False, default=1)
    page_id = db.Column(db.Integer, db.ForeignKey('page.id'), nullable=False)

    def __repr__(self):
        return f"PageText('{self.primary_text}', '{self.secondary_text}', '{self.position}', '{self.page_id}')"
예제 #9
0
class Page(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(30), nullable=False)
    texts = db.relationship('PageText',
                            backref='page',
                            lazy=True,
                            cascade='all, delete')

    def __repr__(self):
        return f"Page('{self.name}')"
예제 #10
0
class NewsCategory(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(30), nullable=False)
    news = db.relationship('News',
                           backref='category',
                           lazy=True,
                           cascade='save-update')

    def __repr__(self):
        return f"NewsCategory('{self.name}')"
예제 #11
0
class Teacher(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(70), nullable=False)
    position = db.Column(db.String(50), nullable=False)
    link = db.Column(db.String(70))
    incumbency = db.Column(db.String(50), nullable=False)
    description = db.Column(db.Text)
    interests = db.Column(db.Text)
    research_directions = db.Column(db.Text)
    hobby = db.Column(db.String(50))
    scopus_id = db.Column(db.String(11))
    scholar_id = db.Column(db.String(12))
    image = db.Column(db.String(20), nullable=False, default='default.jpg')

    def __repr__(self):
        return f"Teacher('{self.name}', '{self.position}', '{self.incumbency}', '{self.description}')"
예제 #12
0
class Course(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False)
    credits = db.Column(db.Integer, nullable=False)
    year = db.Column(db.Enum(Years), default=Years.FIRST)
    semester = db.Column(db.Enum(Semesters), default=Semesters.FIRST)
    related = db.relation('CourseRelationship',
                          primaryjoin=id == CourseRelationship.one_course_id,
                          cascade='all, delete')

    def get_related_courses(self):
        courses = []
        for one in self.related:
            courses.append(
                Course.query.filter_by(id=one.other_course_id).first())
        return courses

    def __repr__(self):
        return f"Course('{self.name}', '{self.credits}', '{self.year}', '{self.semester}')"