@cronjobs.register
def update_blog_posts():
 items = feedparser.parse(settings.DEVELOPER_BLOG_URL)['items']
 if (not items):
  return
 BlogPost.objects.all().delete()
 for item in items[:5]:
  post = {}
  post['title'] = item.title
  post['date_posted'] = parser.parse(item.published)
  post['permalink'] = item.link
  BlogPost.objects.create(**post)
 log.info(('Adding %d blog posts.' % BlogPost.objects.count()))

@ cronjobs . register def update_blog_posts ( ) : items = feedparser . parse ( settings . DEVELOPER_BLOG_URL ) [ 'items' ] if ( not items ) : return BlogPost . objects . all ( ) . delete ( ) for item in items [ : 5 ] : post = { } post [ 'title' ] = item . title post [ 'date_posted' ] = parser . parse ( item . published ) post [ 'permalink' ] = item . link BlogPost . objects . create ( ** post ) log . info ( ( 'Adding %d blog posts.' % BlogPost . objects . count ( ) ) )
update the blog post cache .