Member-only story

How to fix removed template tags in Django admin

Taiwo Kareem
2 min readAug 18, 2024

--

If you upgraded your version of Django, you may have noticed that some template tags has been removed which may cause issues in the django admin. An example is the length_is filter.

Step 1

Create a new file named customtags.py . The file can be named anything and place it in one of your app folder. In that file, write your custom function you want to overwrite.

In my example, I have placed the file in the app called base and created a folder templatetags

base\templatetags\customtags.py

Step 2

Copy the code for the tag that has been removed and paste it in the customtags.py file

Note: You can find removed tags in previous versions of Django on GitHub

I changed the version of Django to 5.0 and navigated to https://github.com/django/django/blob/stable/5.0.x/django/template/defaultfilters.py#L639C1-L651C1

@register.filter(is_safe=False)
def length_is(value, arg):
"""Return a boolean of whether the value's length is the argument."""
warnings.warn(
"The length_is template…

--

--

No responses yet