forked from gergely/calendar-social
Create the Invitation model
This commit is contained in:
parent
69f2a0d9cc
commit
6274543206
@ -552,3 +552,28 @@ class Notification(db.Model):
|
||||
message = messages[0 if self.item == current_user.profile else 1]
|
||||
|
||||
return lazy_gettext(message, actor=self.actor, item=self.item)
|
||||
|
||||
|
||||
class Invitation(db.Model): # pylint: disable=too-few-public-methods
|
||||
"""Database model for event invitations
|
||||
"""
|
||||
|
||||
__tablename__ = 'invitations'
|
||||
|
||||
#: The ID of the sender’s profile
|
||||
sender_id = db.Column(db.Integer(), db.ForeignKey('profiles.id'), primary_key=True)
|
||||
|
||||
sender = db.relationship('Profile', foreign_keys=[sender_id])
|
||||
|
||||
#: The ID of the invitee’s profile
|
||||
invitee_id = db.Column(db.Integer(), db.ForeignKey('profiles.id'), primary_key=True)
|
||||
|
||||
invitee = db.relationship('Profile', foreign_keys=[invitee_id])
|
||||
|
||||
#: The ID of the event
|
||||
event_id = db.Column(db.Integer(), db.ForeignKey('events.id'), primary_key=True)
|
||||
|
||||
event = db.relationship('Event', backref=db.backref('invitations', lazy='dynamic'))
|
||||
|
||||
#: The timestamp of the invitation
|
||||
timestamp = db.Column(db.DateTime(), default=datetime.utcnow)
|
||||
|
Loading…
Reference in New Issue
Block a user