#29418: rss feed returnes 404
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
beshoyfarag |
Type: Bug | Status: new
Component: | Version: 2.0
contrib.syndication |
Severity: Normal | Keywords: 404 , rss ,atom
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
this is what my Django rss feed returns
Page not found (404)
Request Method:
GET
Request URL:
http://127.0.0.1:8000/blog/rss
Raised by:
django.views.generic.detail.DetailView
No post found matching the query
You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a standard
404 page.
my feeds.py
from django.contrib.syndication.views import Feed
from blog.models import Post
from django.utils.feedgenerator import Atom1Feed
from django.utils.html import escape
class RssSiteNewsFeed(Feed):
title = "blog rss "
link = "/blog/rss/"
description = "blog rss and atom feeds ."
def items(self):
return Post.objects.order_by('date')[:10]
def item_title(self, item):
return item.title
def item_description(self, item):
return item.description
def item_link(self, item):
return item.get_absolute_url()
class AtomSiteNewsFeed(RssSiteNewsFeed):
feed_type = Atom1Feed
subtitle = RssSiteNewsFeed.description
my models .py
class Post(models.Model):
title = models.CharField (max_length = 160, null=False)
body = models.TextField( null=False)
date = models.DateTimeField()
author = models.CharField (max_length = 160)
description = models.TextField(max_length = 160)
keywords = models.TextField()
category = models.ForeignKey(Category,on_delete=models.DO_NOTHING)
slug = models.SlugField(max_length = 160,unique=True)
img_url = models.URLField()
short_blog_snippet= models.CharField(max_length = 15)
absolute_url = models.CharField(max_length=400, blank=True,
editable=False)
def __str__(self):
return self.title
def get_absolute_url(self ):
return "/blog/%s" % self.slug
def __unicode__(self):
return self.title
I do not know what i am doing wrong .
--
Ticket URL: <https://code.djangoproject.com/ticket/29418>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.5e2fc3621234706aef8fb4827b027afd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.