openedx.features.calendar_sync package#
Subpackages#
Submodules#
openedx.features.calendar_sync.api module#
API for the Calendar Sync Application
- openedx.features.calendar_sync.api.subscribe_user_to_calendar(user, course_key)#
Enables the Calendar Sync config for a particular user and course. Will create if needed.
- Parameters:
user (User) – The user to subscribe
course_key (CourseKey) – The course key for the subscription
- openedx.features.calendar_sync.api.unsubscribe_user_to_calendar(user, course_key)#
Disables the Calendar Sync config for a particular user and course. If the instance does not exist, this function will do nothing.
- Parameters:
user (User) – The user to subscribe
course_key (CourseKey) – The course key for the subscription
openedx.features.calendar_sync.apps module#
Define the calendar_sync Django App.
openedx.features.calendar_sync.ics module#
Generate .ics files from a user schedule
- openedx.features.calendar_sync.ics.generate_ics_files_for_user_course(course, user, user_calendar_sync_config_instance)#
Generates ics-formatted bytestrings of all assignments for a given course and user.
To pretty-print each bytestring, do: `ics.decode(‘utf8’).replace(’
‘, ‘ ‘)`
Returns a dictionary of ics files, each one representing an assignment.
openedx.features.calendar_sync.models module#
Models for Calendar Sync
- class openedx.features.calendar_sync.models.UserCalendarSyncConfig(*args, **kwargs)#
Bases:
ModelModel to track if a user has the calendar integration enabled for a specific Course
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- course_key#
DO NOT REUSE THIS CLASS. Provided for backwards compatibility only!
A placeholder class that provides a way to set the attribute on the model.
- enabled#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
- ics_sequence#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod is_enabled_for_course(user, course_key)#
Check if the User calendar sync is enabled for a particular course. Returns False if the object does not exist.
- Parameters:
user (User) – The user to check against
course_key (CourseKey) – The course key to check against
- Returns:
(bool) True if the config exists and is enabled. Otherwise, False
- objects = <django.db.models.manager.Manager object>#
- save_without_historical_record(*args, **kwargs)#
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
- user#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- user_id#
openedx.features.calendar_sync.plugins module#
Platform plugins to support Calendar Sync toggle.
- class openedx.features.calendar_sync.plugins.CalendarSyncToggleTool#
Bases:
CourseToolThe Calendar Sync toggle tool.
- classmethod analytics_id()#
Returns an id to uniquely identify this tool in analytics events.
- classmethod data()#
Additional data to send with a form submission
- http_method = 'POST'#
- classmethod icon_classes()#
Returns the icon classes needed to represent this tool.
- classmethod is_enabled(request, course_key)#
The Calendar Sync toggle tool is limited to user enabled through a waffle flag. Staff always has access.
- link_title = 'Calendar Sync'#
- classmethod title()#
Returns the title of this tool.
- toggle_data = {'toggle_data': ''}#
- classmethod url(course_key)#
Returns the URL for this tool for the specified course key.
openedx.features.calendar_sync.signals module#
Signal handler for calendar sync models
- openedx.features.calendar_sync.signals.handle_calendar_sync_email(sender, instance, created, **kwargs)#
openedx.features.calendar_sync.urls module#
Defines URLs for Calendar Sync.
openedx.features.calendar_sync.utils module#
- openedx.features.calendar_sync.utils.calendar_sync_initial_email_content(course_name)#
- openedx.features.calendar_sync.utils.calendar_sync_update_email_content(course_name)#
- openedx.features.calendar_sync.utils.prepare_attachments(attachment_data, file_ext='')#
Helper function to create a list contain file attachment objects for use with MIMEMultipart Returns a list of MIMEApplication objects
- openedx.features.calendar_sync.utils.send_email_with_attachment(to_emails, attachment_data, course_name, is_initial)#
Module contents#
Calendar syncing Course dates with a User.
- openedx.features.calendar_sync.get_calendar_event_id(user, block_key, date_type, hostname)#
Creates a unique event id based on a user and a course block key
- Parameters:
- Returns:
event id (str)