Use Google Calendar UI but showing only filtered events
I have just started using Google Calendar API (using Python client). I'm basically developing a web app for a school with Django.
What I'd like to achieve is something like this:
To make things simple for now, I have 1 Google account and all events will be created in the calendar under that account (this is the school calendar). The calendar will be made public.
When a class is created by a teacher, the class schedule will be automatically added as an event in the Google Calendar. When a student logs in, he can see the school calendar, showing only schedules from the classes that he's registered in.
I think I can filter the calendar feeds to show only class schedules that a student is registered in using Google Data API. The problem is, how can I display Google Calendar on my web app using Google Calendar UI to show only those filtered events?
I can use Google Cal开发者_运维技巧endar UI with the provided embeddable HTML snippet, but I can't control/filter events with that (i.e. all events in the school calendar will be displayed). Or perhaps I'm missing something? I read the Data API guide and the Publishing tool doc but I can't seem to find this information.
THanks in advance!
I found a solution to my current problem, although it doesn't entirely solve it, but enough for what I need now.
Basically I use Google Calendar embeddable HTML, and filter my calendars based using the GET params in the IFrame src.
Each class schedule is saved as a separate calendar within the same account upon the creation of the class. When using embeddable HTML, for each calendar that will be shown, two GET params are added, which is 'src' and 'color'. 'Src' is basically containing calendar ID, which you can get programmatically using the Data API, or from Calendar Setting. Simply add/remove these GET params for the calendars you want to show.
This method is actually very restrictive, as you can only filter based on calendars. If you need more fine-grained filtering on the events to show on the calendar, this won't work. It would be nice to see if there's some kind of ready-to-use UI implementation to work with Google Calendar Data API in near future.
精彩评论