How can I use a variable as index in django template?

后端 未结 3 1033
情话喂你
情话喂你 2020-12-18 09:45

How can I use a variable as index in django template?

Right now I get this error:

Exception Type:
TemplateSyntaxError

Exception Value:    
Could not         


        
3条回答
  •  遥遥无期
    2020-12-18 10:16

    It's possible, but goes against the grain of the Django model...

    If you have items of interest, then ideally your view should return an object just containing those items, (OTTOMH something like):

    Something.objects.filter(something__typename='Bike', year__range=(1998, 2001)) 
    

提交回复
热议问题