TemplateSyntaxError at /admin/userauths/profile/add/


 Request Method: GET 
Request URL: http://127.0.0.1:8000/admin/userauths/profile/add/ 
Django Version: 5.1 
Python Version: 3.12.5
 Installed Applications:
 ['jazzmin',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.messages',
 'django.contrib.staticfiles',
 'hotel',
 'user_dashboard',
 'addon', 
'userauths',
 'import_export',
 'crispy_forms',
 'mathfilters',
 'ckeditor_uploader',
 'django_ckeditor_5',
 'taggit'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] 








Template error:
In template C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\jazzmin\templates\admin\includes\fieldset.html, error at line 22
   Invalid filter: 'length_is'
   12 :         <div class="card-title">
   13 :             {{ fieldset.description }}
   14 :         </div>
   15 :     </div>
   16 :     {%endif%}
   17 : 
   18 :     <div class="p-5{% if fieldset.name %} card-body{% endif %}">
   19 : {% endif %}
   20 : 
   21 :     {% for line in fieldset %}
   22 :     <div class="form-group {% if line.fields|length_is:'1' and line.errors %}  errors{% endif %}{% if not line.has_visible_field %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
   23 :         <div class="row">
   24 :             {% for field in line %}
   25 :                 <label class="{% if not line.fields|length_is:'1' and forloop.counter != 1 %}col-auto {% else %}col-sm-3 {% endif %}text-left" for="id_{{ field.field.name }}">
   26 :                     {{ field.field.label|capfirst }}
   27 :                     {% if field.field.field.required %}
   28 :                     <span class="text-red">* </span>
   29 :                     {% endif %}
   30 :                 </label>
   31 :                 <div class="{% if not line.fields|length_is:'1' %} col-auto  fieldBox {% else %} col-sm-7 {% endif %}
   32 :                              {% if field.field.name %} field-{{ field.field.name }}{% endif %}
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\smartif.py", line 180, in translate_token
    op = OPERATORS[token]
         ^^^^^^^^^^^^^^^^

During handling of the above exception ("line.fields|length_is:'1'"), another exception occurred:
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\handlers\base.py", line 220, in _get_response
    response = response.render()
               ^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\response.py", line 114, in render
    self.content = self.rendered_content
                   ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\response.py", line 92, in rendered_content
    return template.render(context, self._request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\backends\django.py", line 107, in render
    return self.template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 171, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 163, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader_tags.py", line 159, in render
    return compiled_parent._render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 163, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader_tags.py", line 159, in render
    return compiled_parent._render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 163, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader_tags.py", line 65, in render
    result = block.nodelist.render(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader_tags.py", line 65, in render
    result = block.nodelist.render(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader_tags.py", line 65, in render
    result = block.nodelist.render(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader_tags.py", line 210, in render
    return template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 173, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 163, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\defaulttags.py", line 243, in render
    nodelist.append(node.render_annotated(context))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\defaulttags.py", line 327, in render
    return nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader_tags.py", line 199, in render
    template = context.template.engine.select_template(template_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\engine.py", line 208, in select_template
    return self.get_template(template_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\engine.py", line 177, in get_template
    template, origin = self.find_template(template_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\engine.py", line 159, in find_template
    template = loader.get_template(name, skip=skip)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loaders\cached.py", line 57, in get_template
    template = super().get_template(template_name, skip)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loaders\base.py", line 28, in get_template
    return Template(
           
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 154, in __init__
    self.nodelist = self.compile_nodelist()
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 196, in compile_nodelist
    nodelist = parser.parse()
               ^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 518, in parse
    raise self.error(token, e)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 516, in parse
    compiled_result = compile_func(self, token)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\defaulttags.py", line 862, in do_for
    nodelist_loop = parser.parse(
                    
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 518, in parse
    raise self.error(token, e)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 516, in parse
    compiled_result = compile_func(self, token)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\defaulttags.py", line 961, in do_if
    condition = TemplateIfParser(parser, bits).parse()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\defaulttags.py", line 894, in __init__
    super().__init__(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\smartif.py", line 171, in __init__
    mapped_tokens.append(self.translate_token(token))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\smartif.py", line 182, in translate_token
    return self.create_var(token)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\defaulttags.py", line 897, in create_var
    return TemplateLiteral(self.template_parser.compile_filter(value), value)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 605, in compile_filter
    return FilterExpression(token, self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 701, in __init__
    filter_func = parser.find_filter(filter_name)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\base.py", line 611, in find_filter
    raise TemplateSyntaxError("Invalid filter: '%s'" % filter_name)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception Type: TemplateSyntaxError at /admin/userauths/profile/add/
Exception Value: Invalid filter: 'length_is'

What do you think this error is telling you?

pls i dont know i login it came correctly when i click the add profile and it came has error dont know if is the jazzmin settings

So read the complete error message, and find where it’s telling you where the problem is.

difficult for me to read, please i need your help

Part of learning how to work with Django is understanding how to identify and resolve issues like this.
Yes, it may take time and effort to do so, but it’s an important part of the learning process.

yeah i am trying my best

please can you help me identify the problem

I can try.

Please locate, in the traceback, what the actual error message is.

<div class="form-group {% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% if not line.has_visible_field %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">

please I need your help on this

You’re showing the right line in the template where the error is occurring. Now please show the error message itself.

thats what am searching but cant find where it is

It’s at the bottom of the traceback.

this

Exception Value: Invalid filter: 'length_is

Good! That’s the right error.

And what do you think that means?

no idea daddy, dont know if is my jazzmin or

I’m not asking you to identify the cause or reason for the error - we’ll get to that.

I’m asking what does this error message mean? What could cause this error?

i think the profile and the user might cause this