search

Home  >  Q&A  >  body text

**TemplateSyntaxError at /shop/** Unable to parse remaining part: '' from 'product

The following link is the main point link of my index.html

https://gist.github.com/MahdinOhi/b083179a8261b1d89291b69f6d66d5c8

This is my index.html code, I'm getting an error for this code: TemplateSyntaxError at /shop/ Unable to parse the rest: '[1:]' in 'product[1:]' and my carousel The card isn't going the right way (I think it's a CSS bug) This is the error I'm getting (Jpg format):

I want to get the product name and image from the database.

I need to resolve this error. I want to improve my CSS.

P粉269847997P粉269847997512 days ago582

reply all(1)I'll reply

  • P粉982881583

    P粉9828815832023-09-16 11:36:17

    The problem is that

    {% for i in product[1:] %}
      .....
    {% endfor %}

    product[1:] Django templates do not directly support this feature. Instead you can try slice

    {% for i in product|slice:"1:" %}
    
      ... Rest of your template codes
    
    {% endfor %}

    reply
    0
  • Cancelreply