I wrote a pretty complex event calendar for my PHP-Nuke site. You can find it here on sourceforge. It allows users to submit events for admin approval. Once approved they appear on the calendar. The application does all the calendar logic, including the drawing of the calendar. Repeating events were added, and they are pretty hairy as well. There are some pretty massively complicated SQL queries in that code, not to mention some crazy PHP logic to figure out if repeating events belong on a particular calendar view. It is also possible to make exceptions to repeating events.
I’ve been thinking about how to port this to my new Django powered site. One day I stumbled across the Google Calendar API, and I’m thinking about leveraging this. I will let Google handle all the crazy calendar logic, as they are no doubt better at it than I am. I will still let users submit events to the admin, but this time I will use the Google API to add events to a Google Calendar. Google can do the heavy lifting for me when it comes to displaying events and handling repeating events. Am I cheating by doing this? Ha. Well there are some advantages to this idea for my end users:
So I’ve decided to explore this approach. If it doesn’t look like it will pan out, I will fall back to a more direct port of my old PHP code.
This approach isn’t without its own challenges. I can see right now I am going to have to think carefully about how to provide authentication to the Django code to allow it to add events to one of my Google calendars. I obviously don’t want to hard code my Google login and password in the Django application.
I think I will attack this problem in phases:
I’ve already downloaded the Python version of the gdata library and have started reading the API docs. It looks interesting. Once I get familiar with this library, it looks like I could use it for other cool things like interfacing with YouTube and Google Docs.
how did this API work out for you? i’m using modx and i need to have visitors submit events, which will need to be reviewed. and i’m stumped.
I’m just about ready to start using the gdata API. Right now I have a form built for a user to submit an event and hold it for approval. Next I need to build an admin function to approve events and use the gdata API to add them to a Google calendar. I should know more this weekend, time willing, and will report the results.
I am doing almost literally the same thing, any luck with this approach?
Yes. I haven’t gone live with this yet, but I have something working. The only thing I punted on for right now was repeating events. If you look at my later blog entries that are tagged with “calendar” you’ll see a few more posts on this matter.