-
Notifications
You must be signed in to change notification settings - Fork 16
/
feed.py
34 lines (25 loc) · 1014 Bytes
/
feed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from django.contrib.syndication.views import Feed
# from django.contrib.syndication.feeds import Feed
from events.models import Event
from django.utils.feedgenerator import Atom1Feed
import datetime
class RssProgramFeed(Feed):
title = "www.KSET.org"
link = "http://www.kset.org/"
description = "Klub studenata elektrotehnike - Program"
description_template = "templates/feed_description.html"
def item_pubdate(self, obj):
if (obj.time):
return datetime.datetime(obj.date.year, obj.date.month, obj.date.day,
obj.time.hour, obj.time.minute)
else:
return datetime.datetime(obj.date.year, obj.date.month, obj.date.day)
def items(self):
return Event.objects.get_forward()
def item_title(self, item):
return item.title
def item_description(self, item):
return item.description + item.content
class AtomProgramFeed(RssProgramFeed):
feed_type = Atom1Feed
subtitle = RssProgramFeed.description