django writing my first custom template tag and filter
Question: I am attempting to write a simple django [Custom template tags and
filters](https://docs.djangoproject.com/en/1.4/howto/custom-template-tags/) to
replace a html break (< b r / >) with a line space on a template.

I have followed the django docs, but I am getting the following error, which I
don't know how to solve.

The error I have is:

    
    
    x_templates_extra' is not a valid tag library: Template library x_templates_extra not found, tried django.templatetags.x_templates_extra,django.contrib.staticfiles.templatetags.x_templates_extra,django.contrib.admin.templatetags.x_templates_extra,django.contrib.flatpages.templatetags.x_templates_extra,rosetta.templatetags.x_templates_extra,templatetag_handlebars.templatetags.x_templates_extra,globalx.common.templatetags.x_templates_extra,rollyourown.seo.templatetags.x_templates_extra,debug_toolbar.templatetags.x_templates_extra
    

Here is what I have done:

    
    
    1. created a templatetags directory, at the same level as models.py, views.py, etc
    
    2. created a __init__.py file inside the templatetags directory to ensure the directory is treated as a Python package
    
    3. created a file inside the templatetags directory called x_templates_extra.py
    
    4. added the load tag to the template: {% load x_templates_extra %}
    
    5. added the tag to the template: {{ x_detail.x_details_institution_name|safe|replace:"<br />"|striptags|truncatechars:popover_string_length_20 }}
    
    6. Added the following code to the file x_templates_extra.py:
    
    from django import template
    
    register = template.Library()
    
    def replace(value, arg):
       """Replaces all values of arg from the given string with a space."""
        return value.replace(arg, ' ')
    

**Question:**

The docs state that: So, near the top of your module, put the following:

    
    
    from django import template
    
    register = template.Library()
    

I have put the import & register lines in my file called: called
x_templates_extra.py. Is that correct?

Also I am not sure what to put in the INSTALLED_APPS to make the load work.

Tried many things, but I am now going in circles, so I do need help.

Thanks.


Answer: Finally got it to work.

adding the correct app name to the INSTALLED APPS was th eissue.

