I have a data attached with multiple spaces, I want to print the data on html page along with spaces but in html spaces are getting stripped off. I found a solution of creating a package as nbsp and use that in template. I tried that but it is throwing error as " 'nbsp' is not a registered tag library I am able to import nbsp package which I have kept in templatetags directory explicitly in python interactive mode "python manage.py shell". Below is the code details: nbsp.py: from django import template from django.utils.safestring import mark_safe register = template.Library() @register.filter() def nbsp(value): return mark_safe(" ".join(value.split(' '))) html: {% load nbsp %} {% for x in data %} {{ x | nbsp }} {% endfor %}
Pleas let me know ur suggestions where I am going wrong. Thanks in Advance, Anjali -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/75478ccd-feed-4835-9e67-4474a2bfc246%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.