diff --git a/calsocial/models.py b/calsocial/models.py index 2f3feba..bd274dd 100644 --- a/calsocial/models.py +++ b/calsocial/models.py @@ -35,6 +35,12 @@ users_roles = db.Table( db.Column('role_id', db.Integer(), db.ForeignKey('roles.id'))) +def generate_uuid(): + from uuid import uuid4 + + return uuid4().hex + + class SettingsProxy: """Proxy object to get settings for a user """ @@ -197,6 +203,9 @@ class Event(db.Model): # pylint: disable=invalid-name id = db.Column(db.Integer(), primary_key=True) + #: The UUID of the event. This is what is presented to the users and used in federation. + event_uuid = db.Column(db.String(length=40), unique=True, nullable=False, default=generate_uuid) + #: The ID of the user who created the event user_id = db.Column(db.Integer(), db.ForeignKey('users.id'), nullable=False)