@register.filter(is_safe=False)
def dictsort(value, arg):
 try:
  return sorted(value, key=Variable(arg).resolve)
 except (TypeError, VariableDoesNotExist):
  return u''

@ register . filter ( is_safe = False ) def dictsort ( value , arg ) : try : return sorted ( value , key = Variable ( arg ) . resolve ) except ( TypeError , VariableDoesNotExist ) : return u''
takes a list of dicts .