Add the Event.visibility field

This shows if the event is visible to anyone or just people who are invited.

The calendar view already respects this flag.
This commit is contained in:
2018-07-16 12:12:35 +02:00
parent f2f7ef72dd
commit a862e6ca5d
4 changed files with 66 additions and 2 deletions

View File

@@ -103,6 +103,23 @@ class ResponseType(Enum):
return Enum.__eq__(self, other)
class EventVisibility(Enum):
"""Enumeration for event visibility
"""
#: The event is private, only attendees and people invited can see the details
private = 0
#: The event is public, anyone can see the details
public = 5
EVENT_VISIBILITY_TRANSLATIONS = {
EventVisibility.private: _('Visible only to attendees'),
EventVisibility.public: _('Visible to everyone'),
}
class SettingsProxy:
"""Proxy object to get settings for a user
"""
@@ -399,6 +416,9 @@ class Event(db.Model):
#: The description of the event
description = db.Column(db.UnicodeText())
#: The visibility of the event
visibility = db.Column(db.Enum(EventVisibility), nullable=False)
def __as_tz(self, timestamp, as_timezone=None):
from pytz import timezone, utc