How to apply multiple filters on a Django template when i use django-ckeditor without error?

263 views Asked by At

i am using django-ckeditor as a app_contect field in models so How to apply multiple filters on a Django template , when i add multiple filters in html page it show error in my design

my code in html page :

<p class="card-text" id="font_control_for_all_pages">{{ android.app_contect|truncatechars:153|safe }}</p>

this photo without ( |safe ) enter image description here

and this with (|safe)

enter image description here

1

There are 1 answers

0
DrMeers On BEST ANSWER

I don't think your issue relates to multiple filters or ckeditor as much as the fact that you're truncating HTML content and then trying to render it assuming the syntax is still valid/intact. You might want to look into truncatechars_html which will respect the underlying tags when performing the truncation instead of truncatechars