Coder Social home page Coder Social logo

charettes / django-gcal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from incuna/django-gcal

1.0 3.0 0.0 113 KB

A Django application allowing developers to synchronise instances of their models with Google Calendar.

License: MIT License

Python 100.00%

django-gcal's Introduction

djangogcal

Forked from https://code.google.com/p/django-gcal/ on Google Code, by metzen and emperorofcheese.

Released under an MIT licence.

About

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.

Usage

In a typical scenario, the following steps are required to use django-gcal:

  • Add djangogcal to the list of installed applications in your settings.py.
  • Define a djangogcal.adapter.CalendarAdapter for each model you want synchronised.
  • Instantiate a djangogcal.observer.CalendarObserver for each Google Calendar feed.
  • Call the CalendarObserver.observe(model, adapter) method to link models with the Google Calendar feed.
  • See GettingStarted for more information, and RelatedModels for information about sending updates when related objects are changed.

Example

The 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())

django-gcal's People

Contributors

charettes avatar incuna-who avatar jturnbull avatar mjtamlyn avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.