Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Changed latestblogentry templatetag in django_website.blog app to ign…

…ore future entries

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@3536 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 619faa2ef40b57f0752d98081a864f1a0b7a6b0e 1 parent 7d344a1
authored
3  django_website/apps/blog/templatetags/latestblogentry.py
... ...
@@ -1,12 +1,13 @@
1 1
 from django import template
2 2
 from django_website.apps.blog.models import Entry
  3
+import datetime
3 4
 
4 5
 class LatestBlogEntriesNode(template.Node):
5 6
     def __init__(self, num, varname):
6 7
         self.num, self.varname = num, varname
7 8
 
8 9
     def render(self, context):
9  
-        context[self.varname] = list(Entry.objects.all()[:self.num])
  10
+        context[self.varname] = list(Entry.objects.filter(pub_date__lte=datetime.datetime.now())[:self.num])
10 11
         return ''
11 12
 
12 13
 def do_get_latest_blog_entries(parser, token):

0 notes on commit 619faa2

Please sign in to comment.
Something went wrong with that request. Please try again.