Sort instances by status then name directly in template