from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
from events.models import ChronokiwiEvent, ChronokiwiChronology

class LatestEntries(Feed):
    title = "Chronokiwi news"
    link = "/events"
    description = "Updates on changes and additions to Chronokiwi."
    title_template = 'events/feed_title.html'
    description_template = 'events/feed_description.html'
    # 
    # def link(self, obj):
        # if not obj:
            # raise FeedDoesNotExist
        # return obj.get_absolute_url()

    def items(self):
        return ChronokiwiEvent.objects.order_by('-lastUpdate')[:5]