Created
November 27, 2020 09:20
-
-
Save olamigokayphils/f211f1a5fe838ea571059437940d2840 to your computer and use it in GitHub Desktop.
Setting up RSS Feed in your Django app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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