Пример #1
0
def post_all_feed(request):
    """Returns a Feed for all posts"""

    feed = PostsFeedAtom('myslug', request)
    feed.items = Post.objects.published().order_by('-pub_date')

    return feed_render(feed)
Пример #2
0
def post_month_feed(request, year, month):
    """Returns an atom feed for the month."""
    feed = PostsFeedAtom('myslug', request)

    tt = time.strptime('-'.join([year, month]), '%Y-%b')
    date = datetime.date(*tt[:3])
    feed.items = Post.objects.published().filter(pub_date__year=date.year,
                            pub_date__month=date.month)

    return feed_render(feed)
Пример #3
0
def post_day_feed(request, year, month, day):
    """Produces a feed for the post daily list."""

    feed = PostsFeedAtom('myslug', request)

    tt = time.strptime('-'.join([year, month, day]), '%Y-%b-%d')
    date = datetime.date(*tt[:3])
    feed.items = Post.objects.published().filter(pub_date__year=date.year,
                            pub_date__month=date.month, pub_date__day=date.day)

    return feed_render(feed)
Пример #4
0
def post_year_feed(request, year):
    """Returns a Feed for particular year."""

    feed = PostsFeedAtom('myslug', request)
    feed.link = reverse('blog:list-year', args=[year])

    # Get the actual Items
    tt = time.strptime('-'.join([year]), '%Y')
    date = datetime.date(*tt[:3])
    feed.items = Post.objects.published().filter(pub_date__year=date.year).order_by('-pub_date')

    return feed_render(feed)