def create_ICS_event(self): ICS_event = ICS_Event() ICS_event.name = self.name ICS_event.begin = self.begin ICS_event.end = self.end ICS_event.location = self.location ICS_event.description = self.description ICS_event.categories = self.categories return ICS_event
def create_calendar(uri): c = Calendar(creator="rss2cal.py by raivivek") parsed_feed = feedparser.parse(uri) for entry in parsed_feed.entries: e = Event() e.name = entry.title e.begin = arrow.get(entry.ev_startdate) e.end = arrow.get(entry.ev_enddate) e.description = entry.description e.location = entry.ev_location e.url = entry.link e.categories = [entry.category] c.events.add(e) return c
def calendar_view(request, whatever): from ics import Calendar, Event actions, ctx = _get_actions(request, include_future=True, include_past=30) thecal = Calendar() thecal.creator = 'XR Mass Events' for action in actions: evt = Event() evt.uid = '{}@{}'.format(action.id, request.get_host()) evt.name = action.html_title evt.description = action.description evt.categories = action.tags.names() evt.last_modified = action.modified evt.url = request.build_absolute_uri(action.get_absolute_url()) evt.begin = action.when evt.duration = timedelta(hours=1) # evt.end = action.when + timedelta(hours=1) evt.location = action.location thecal.events.add(evt) response = HttpResponse(thecal, content_type='text/calendar') return response