Hi Anjali,
 Where inside your project are you storing the nbsp.py file?
Regards,

Asad Jibran Ahmed <surfer...@gmail.com>
http://blog.asadjb.com

On Tue, Jan 10, 2017 at 11:09 AM, <anjalim...@gmail.com> wrote:

> 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("&nbsp;".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
> <https://groups.google.com/d/msgid/django-users/75478ccd-feed-4835-9e67-4474a2bfc246%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BYYaWc%2Bsq6eARE%3DXz2UKEG4pEVC3x9vkM4G2jd7FNpCUyrJLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to