Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This should go in app/templatetags/app_tags.py
- from django.template import Library
- from app.models import Post
- register = Library()
- @register.inclusion_tag('app/_latest_posts.html')
- def latest_posts():
- posts = Post.objects.order_by('-date')[:6]
- return locals()
Add Comment
Please, Sign In to add comment