Use custom templates tag instead doing it directly... make a function
stating your {% query_set %} and then use it inside the template.On Sat, 25 Jan 2020, 18:29 Jani Eric, <[email protected]> wrote: > thanks bro > > > On Saturday, January 25, 2020 at 3:11:33 PM UTC+5, Chinmay Dali wrote: >> >> I am trying to loop over a product list{more so a queryset} in django using >> for loop, by adding the range of products The following code works when >> printed out in cmd prompt >> >> I am doing something like this >> >> ''' >> >> for card in allproduct[nextRangePage:limit]: >> >> ''' >> >> in django template using this >> >> ''' >> >> {% for card in allproduct[{%'nextRangePage'%}:{%'limit'%}] %} >> >> ''' >> >> it gives the following the error: >> >> ``` >> >> *django.template.exceptions.TemplateSyntaxError: Could not parse the >> remainder: '[{%'nextRangePage'' from 'allproduct[{%'nextRangePage''* >> >> ``` >> >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/a9b2cafa-d9eb-4ec7-a3f7-24edd1f42ee7%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/a9b2cafa-d9eb-4ec7-a3f7-24edd1f42ee7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOnqjLwgQMF%2B-Uo7kdNzSCQ_1tPRYc-DsSU5yAB5JUnQZWeWTg%40mail.gmail.com.

