Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
comparing forloop variables to a number
 <ul class="navbar-nav mr-auto">
            <li class="nav-item">
              <a class="nav-link" href="/">Home </a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="{% url 'store' %}">Products</a>
            </li>
            {% for x in cat %}
            <li class="nav-item">
              <a class="nav-link" href="#">{{x.name}}</a>
            </li>
            {% if forloop.counter >3%}
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">More</a>
              <div class="dropdown-menu">
                <a class="dropdown-item" href="#">{{x.name}}</a>
                
              </div>
            </li>
            {% endif %}

            {% endfor %}
          
            
          </ul>

So what i want here is the objects in the for loop counter be more that three then all should come in the dropdown menu which but it is not working as of now and giving me this error what is the best way to handle this problem

Could not parse the remainder: '>3' from '>3'
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 4.0
Exception Type: TemplateSyntaxError
Exception Value:    
Could not parse the remainder: '>3' from '>3'
Exception Location: C:\Users\saran\OneDrive\Desktop\e-com-test\core\hienv\lib\site-packages\django\template\base.py, line 692, in __init__
Python Executable:  C:\Users\saran\OneDrive\Desktop\e-com-test\core\hienv\Scripts\python.exe
Python Version: 3.9.6
Python Path:    
['C:\\Users\\saran\\OneDrive\\Desktop\\e-com-test\\core',
 'C:\\Users\\saran\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip',
 'C:\\Users\\saran\\AppData\\Local\\Programs\\Python\\Python39\\DLLs',
 'C:\\Users\\saran\\AppData\\Local\\Programs\\Python\\Python39\\lib',
 'C:\\Users\\saran\\AppData\\Local\\Programs\\Python\\Python39',
 'C:\\Users\\saran\\OneDrive\\Desktop\\e-com-test\\core\\hienv',
 'C:\\Users\\saran\\OneDrive\\Desktop\\e-com-test\\core\\hienv\\lib\\site-packages']
Server time:    Fri, 10 Dec 2021 13:32:32 +0
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Try adding spaces

{% if forloop.counter > 3 %}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda