Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Django Rendering Template Included in a Template
  2. -base.html
  3.      |---------latest_update.html
  4.        
  5. from django import template
  6.  
  7. from app.models import UpdateObject
  8.  
  9. register = template.Library()
  10. @register.inclusion_tag("latest_update.html")
  11. def latest_update():
  12.   update_objects = UpdateObject.all().[:10]
  13.   return {"update_objects": update_objects}
  14.        
  15. {% load latest_update_tags %}
  16. ......
  17. {% latest_update %}