Create the Event model
This commit is contained in:
parent
6c4eb97c01
commit
bac17faed2
@ -54,3 +54,34 @@ class Role(db.Model, RoleMixin):
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Role {self.id}({self.name})>'
|
||||
|
||||
|
||||
class Event(db.Model):
|
||||
__tablename__ = 'events'
|
||||
id = db.Column(db.Integer(), primary_key=True)
|
||||
|
||||
#: The ID of the user who created the event
|
||||
user_id = db.Column(db.Integer(), db.ForeignKey('users.id'), nullable=False)
|
||||
|
||||
user = db.relationship('User', backref=db.backref('events', lazy='dynamic'))
|
||||
|
||||
#: The title of the event
|
||||
title = db.Column(db.Unicode(length=200), nullable=False)
|
||||
|
||||
#: The time zone to be used for `start_time` and `end_time`
|
||||
time_zone = db.Column(db.String(length=80), nullable=False)
|
||||
|
||||
#: The starting timestamp of the event
|
||||
start_time = db.Column(db.DateTime(), nullable=False)
|
||||
|
||||
#: The ending timestamp of the event
|
||||
end_time = db.Column(db.DateTime(), nullable=False)
|
||||
|
||||
#: If `True`, the event is a whole-day event
|
||||
all_day = db.Column(db.Boolean(), default=False)
|
||||
|
||||
#: The description of the event
|
||||
description = db.Column(db.UnicodeText())
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Event {self.id} ({self.title}) of {self.user}>'
|
||||
|
Loading…
Reference in New Issue
Block a user