blob: 9ac84c6574d2ec3445b3c228e1dff8aab99c35f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
from django.contrib.syndication.views import Feed
from django.template.defaultfilters import slugify
from .models import Event
from datetime import datetime, time
class EventFeed(Feed):
title = description = "PostgreSQL events"
link = "https://www.postgresql.org/"
description_template = 'events/rss_description.html'
title_template = 'events/rss_title.html'
def items(self):
return Event.objects.filter(approved=True)[:10]
def item_link(self, obj):
return "https://www.postgresql.org/about/event/{}-{}/".format(slugify(obj.title), obj.id)
def item_pubdate(self, obj):
return datetime.combine(obj.startdate, time.min)
|