# Path: shiori/bookmark/models.py
# class Bookmark(BaseObject):
#     """ Bookmark model """
#     url = models.URLField()
#     title = models.CharField(max_length=255)
#     category = models.ForeignKey(Category)
#     tags = models.ManyToManyField(Tag, through='BookmarkTag')
#     registered_datetime = models.DateTimeField(auto_now=True,
#                                                auto_now_add=True)
#     description = models.TextField(blank=True)
#     owner = models.ForeignKey(User)
#     is_hide = models.BooleanField(default=False)
# 
#     class Meta(object):
#         """ meta class """
#         db_table = 'bookmark'
#         unique_together = ('url', 'owner')
# 
#     def __unicode__(self):
#         return self.title
# 
#     def get_absolute_url(self):
#         """ bookmark permalink path """
#         return "/shiori/b/%s" % self.id


from django.contrib.syndication.views import Feed
from shiori.bookmark.models import Bookmark
# -*- coding: utf-8 -*-
""" module of feed generator """


class LatestEntries(Feed):
    """ Feed generator class """
    title = 'Shiori new bookmarks'
    link = '/shiori/'
    description = 'Updates on changes and additions to Shiori.'
    description_template = 'feeds/latest_title.html'

    def items(self):
        """ Retrieve latest 5 bookmarks """

# Path: shiori/bookmark/models.py
# class Bookmark(BaseObject):
#     """ Bookmark model """
#     url = models.URLField()
#     title = models.CharField(max_length=255)
#     category = models.ForeignKey(Category)
#     tags = models.ManyToManyField(Tag, through='BookmarkTag')
#     registered_datetime = models.DateTimeField(auto_now=True,
#                                                auto_now_add=True)
#     description = models.TextField(blank=True)
#     owner = models.ForeignKey(User)
#     is_hide = models.BooleanField(default=False)
# 
#     class Meta(object):
#         """ meta class """
#         db_table = 'bookmark'
#         unique_together = ('url', 'owner')
# 
#     def __unicode__(self):
#         return self.title
# 
#     def get_absolute_url(self):
#         """ bookmark permalink path """
#         return "/shiori/b/%s" % self.id


# Path: shiori/bookmark/feed_generator.py
from django.contrib.syndication.views import Feed
from shiori.bookmark.models import Bookmark

# -*- coding: utf-8 -*-
""" module of feed generator """


class LatestEntries(Feed):
    """ Feed generator class """
    title = 'Shiori new bookmarks'
    link = '/shiori/'
    description = 'Updates on changes and additions to Shiori.'
    description_template = 'feeds/latest_title.html'

    def items(self):
        """ Retrieve latest 5 bookmarks """

        return Bookmark.objects.order_by('-registered_datetime')[:5]