@register.inclusion_tag(u'admin/includes/recent_comments.html', takes_context=True)
def recent_comments(context):
 latest = context[u'settings'].COMMENTS_NUM_LATEST
 comments = ThreadedComment.objects.all().select_related(u'user')
 context[u'comments'] = comments.order_by(u'-id')[:latest]
 return context

@ register . inclusion_tag ( u'admin/includes/recent_comments.html' , takes_context = True ) def recent_comments ( context ) : latest = context [ u'settings' ] . COMMENTS_NUM_LATEST comments = ThreadedComment . objects . all ( ) . select_related ( u'user' ) context [ u'comments' ] = comments . order_by ( u'-id' ) [ : latest ] return context
dashboard widget for displaying recent comments .