Last active
May 12, 2019 20:10
-
-
Save svschannak/0be886cc69a180c99820338ea136d05f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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