|
Project Information
Featured
|
A Django application allowing developers to synchronise instances of their models with Google Calendar. Using Django's signals mechanism and generic relations, no changes to the model being synchronised are required, and synchronisation occurs without user intervention over the models lifecycle. InstallationCheckout the contents of http://django-gcal.googlecode.com/svn/trunk/ to somewhere on your PYTHONPATH. UsageIn a typical scenario, the following steps are required to use django-gcal:
See GettingStarted for more information, and RelatedModels for information about sending updates when related objects are changed. ExampleThe code in this example is sufficient to bind a model to Google Calendar. from django.conf import settings
from djangogcal.adapter import CalendarAdapter, CalendarEventData
from djangogcal.observer import CalendarObserver
from models import Showing
class ShowingCalendarAdapter(CalendarAdapter):
"""
A calendar adapter for the Showing model.
"""
def get_event_data(self, instance):
"""
Returns a CalendarEventData object filled with data from the adaptee.
"""
return CalendarEventData(
start=instance.start_time,
end=instance.end_time,
title=instance.title
)
observer = CalendarObserver(email=settings.CALENDAR_EMAIL,
password=settings.CALENDAR_PASSWORD)
observer.observe(Showing, ShowingCalendarAdapter())
|