@register.assignment_tag
def get_code_samples_latest(limit=5):
 return CodeSample.objects.published()[:limit]

@ register . assignment_tag def get_code_samples_latest ( limit = 5 ) : return CodeSample . objects . published ( ) [ : limit ]
return last 5 published code samples .