Skip to content

Instantly share code, notes, and snippets.

@svschannak
Last active May 12, 2019 20:10
Show Gist options
  • Save svschannak/0be886cc69a180c99820338ea136d05f to your computer and use it in GitHub Desktop.
Save svschannak/0be886cc69a180c99820338ea136d05f to your computer and use it in GitHub Desktop.
# views.py
class EventFeed(ICalFeed):
"""
A simple event calender
"""
product_id = '-//example.com//Example//EN'
timezone = 'UTC'
file_name = "event.ics"
def items(self):
return Event.objects.all().order_by('-date')
def item_guid(self, item):
return "{}{}".format(item.id, "global_name")
def item_title(self, item):
return "{}".format(item.name)
def item_description(self, item):
return item.description
def item_start_datetime(self, item):
return item.date
def item_link(self, item):
return "http://www.google.de"
# urls.py
urlpatterns = [
...,
url(r'^latest/feed.ics$', EventFeed()),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment