Create the Invitation model
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user