Skip to content

Instantly share code, notes, and snippets.

@olamigokayphils
Created November 27, 2020 09:20
Show Gist options
  • Save olamigokayphils/f211f1a5fe838ea571059437940d2840 to your computer and use it in GitHub Desktop.
Save olamigokayphils/f211f1a5fe838ea571059437940d2840 to your computer and use it in GitHub Desktop.
Setting up RSS Feed in your Django app
from django.contrib.syndication.views import Feed
from django.urls import reverse
from blog.models import BlogPost
class LatestEntriesFeed(Feed):
title = "Blog | Olamigoke Philip"
link = "/feeds/"
description = "I'm Ola; a Full stack web developer. I also ..."
def items(self):
return BlogPost.objects.order_by("-id")[:10]
def item_title(self, item):
return item.title
def item_description(self, item):
return item.description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment