{% if obj.name %} {{ obj.name|truncatewords:"10" }} {% else %} {{ obj.text|truncatewords:"10" }} {% endif %}