Beispiel #1
0
class Solution(db.Model):  # Класс решения
    id = db.Column(db.Integer, primary_key=True)
    code = db.Column(db.String(1000), unique=False, nullable=False)
    status = db.Column(db.String(50), unique=False, nullable=False)
    student_id = db.Column(db.Integer,
                           db.ForeignKey('student.id'),
                           nullable=False)
    student = db.relationship('Student',
                              backref=db.backref('Solutions', lazy=True))
    task_id = db.Column(db.Integer, db.ForeignKey('task.id'), nullable=False)
    task = db.relationship('Task', backref=db.backref('Solutions', lazy=True))
Beispiel #2
0
class Comment(db.Model):  # Класс комментария
    id = db.Column(db.Integer, primary_key=True)
    author = db.Column(db.String(100), unique=False, nullable=False)
    content = db.Column(db.String(1000), unique=False, nullable=False)
    article_id = db.Column(db.Integer,
                           db.ForeignKey('article.id'),
                           nullable=False)
    article = db.relationship('Article',
                              backref=db.backref('Comments', lazy=True))
Beispiel #3
0
class Club(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), unique=True, nullable=False)
    league = db.Column(db.String(100), default='Uganda Premier League')
    logo_name = db.Column(db.String(200), default='avatar.png')
    home_rating = db.Column(db.Float, default=0.0)
    away_rating = db.Column(db.Float, default=0.0)
    ave_rating = db.Column(db.Float, default=0.0)
    manager = db.relationship('Manager',
                              secondary=club_manager,
                              backref=db.backref('clubs', lazy='dynamic'))
    players = db.relationship(
        'Player',
        secondary=club_players,
        backref=db.backref('clubs', lazy='dynamic'),
    )

    def __init__(self, *args, **kwargs):
        super(Club, self).__init__(*args, **kwargs)

    def __repr__(self):
        return '<Club: %s >' % self.name
Beispiel #4
0
class Photo(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	identifier = db.Column(db.String(100))
	photo_name = db.Column(db.String(100))
	created_time = db.Column(db.DateTime, default=datetime.datetime.now)
	faces = db.relationship('Face', secondary=faces,
			backref=db.backref('photos', lazy='dynamic')
		)

	def __init__(self, *args, **kwargs):
		super(Photo, self).__init__(*args, **kwargs)

	def __repr__(self):
		return '<Photo: %s>' % self.identifier
Beispiel #5
0
class Player(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    first_name = db.Column(db.String(100))
    last_name = db.Column(db.String(100))
    role = db.Column(db.String(100), nullable=False)
    curr_perf = db.Column(db.Float, default=0.00)
    photo_name = db.Column(db.String(400), unique=True, nullable=False)
    date_of_birth = db.Column(db.DateTime, nullable=False)
    week = db.Column(db.Integer, default=0)
    num_matches = db.Column(db.Integer, default=0)
    stats = db.relationship('Stats',
                            secondary=player_stats,
                            backref=db.backref('players', lazy='dynamic'))
    performance = db.relationship(
        'Performance',
        secondary=player_performance,
        backref=db.backref('players', lazy='dynamic'),
    )

    def __init__(self, *args, **kwargs):
        super(Player, self).__init__(*args, **kwargs)

    def __repr__(self):
        return '<Player: %s >' % self.first_name
Beispiel #6
0
class Manager(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    first_name = db.Column(db.String(100))
    last_name = db.Column(db.String(100))
    email = db.Column(db.String(100), unique=True, nullable=False)
    password = db.Column(db.String(100), nullable=False)
    image_name = db.Column(db.String(400), default='avatar.png')
    messages = db.relationship('Message',
                               secondary=manager_messages,
                               backref=db.backref('managers', lazy='dynamic'))

    def __init__(self, *args, **kwargs):
        super(Manager, self).__init__(*args, **kwargs)

    def __repr__(self):
        return '<Manager; First Name: %s >' % self.first_name
Beispiel #7
0
class Account(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	name = db.Column(db.String(100))
	email = db.Column(db.String(100))
	phone = db.Column(db.String(20))
	password = db.Column(db.String(100))
	photo_name = db.Column(db.String(400), default='avatar.png')
	created_time = db.Column(db.DateTime)
	id_photos = db.relationship('Photo', secondary=id_photos,
			backref=db.backref('users', lazy='dynamic')
		)

	def __init__(self, *args, **kwargs):
		super(Account, self).__init__(*args, **kwargs)

	def __repr__(self):
		return '<Account: %s>' % self.name