Changes between Initial Version and Version 2 of Ticket #29418


Ignore:
Timestamp:
May 19, 2018, 3:59:29 PM (7 years ago)
Author:
BeshoyFarag
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29418

    • Property Cc BeshoyFarag added
  • Ticket #29418 – Description

    initial v2  
    1212You'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.
    1313
    14 my feeds.py
    15 
    16 from django.contrib.syndication.views import Feed
    17 from blog.models import Post
    18 from django.utils.feedgenerator import Atom1Feed
    19 from django.utils.html import escape
    20 
    21 class RssSiteNewsFeed(Feed):
    22     title = "blog rss "
    23     link = "/blog/rss/"
    24     description = "blog rss and atom feeds ."
    25 
    26     def items(self):
    27         return Post.objects.order_by('date')[:10]
    28 
    29     def item_title(self, item):
    30         return item.title
    31 
    32     def item_description(self, item):
    33         return item.description
    34 
    35     def item_link(self, item):
    36        return item.get_absolute_url()
    37 
    38 class AtomSiteNewsFeed(RssSiteNewsFeed):
    39     feed_type = Atom1Feed
    40     subtitle = RssSiteNewsFeed.description
    41 
    42 my models .py
    43 
    44 class Post(models.Model):
    45   title = models.CharField (max_length = 160, null=False)
    46   body = models.TextField( null=False)
    47   date = models.DateTimeField()
    48   author =  models.CharField (max_length = 160)
    49   description = models.TextField(max_length = 160)
    50   keywords = models.TextField()
    51   category = models.ForeignKey(Category,on_delete=models.DO_NOTHING)
    52   slug =  models.SlugField(max_length = 160,unique=True)
    53   img_url = models.URLField()
    54   short_blog_snippet=  models.CharField(max_length = 15)
    55   absolute_url = models.CharField(max_length=400, blank=True, editable=False)
    56 
    57 
    58   def __str__(self):
    59 
    60 
    61    
    62     return self.title
    63  
    64   def get_absolute_url(self ):
    65        
    66      return "/blog/%s" % self.slug
    67   def __unicode__(self):
    68     return self.title
    6914
    7015
Back to Top