Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
adrian authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  django_website/apps/blog/templatetags/latestblogentry.py
View
3  django_website/apps/blog/templatetags/latestblogentry.py
@@ -1,12 +1,13 @@
from django import template
from django_website.apps.blog.models import Entry
+import datetime
class LatestBlogEntriesNode(template.Node):
def __init__(self, num, varname):
self.num, self.varname = num, varname
def render(self, context):
- context[self.varname] = list(Entry.objects.all()[:self.num])
+ context[self.varname] = list(Entry.objects.filter(pub_date__lte=datetime.datetime.now())[:self.num])
return ''
def do_get_latest_blog_entries(parser, token):
Please sign in to comment.
Something went wrong with that request. Please try again.