Re: Django jinja queryset filter lenth

2020-08-12 Thread N'BE SORO
thank you Le dim. 9 août 2020 à 09:12, Liu Zheng a écrit : > Hi, > > Not sure it's a good idea to do database query inside the template. > Templates are capable of running some logics but for a heavy-lifting job > like database query, it should be a good practice to do it in the view, and >

Re: Django jinja queryset filter lenth

2020-08-09 Thread Liu Zheng
Hi, Not sure it's a good idea to do database query inside the template. Templates are capable of running some logics but for a heavy-lifting job like database query, it should be a good practice to do it in the view, and only pass the results to the template. On Sun, Aug 9, 2020 at 4:30 AM Agoua

Re: Django jinja queryset filter lenth

2020-08-08 Thread Agoua David
As Django template engine do not support the parenthèses you Can try to make a custom filter Le sam. 8 août 2020 à 20:27, Agoua David a écrit : > You Can try to use .count instead > > Le sam. 8 août 2020 à 17:56, N'BE SORO a écrit : > >> Good evening please >> >> Can you help me? >> >> I want

Re: Django jinja queryset filter lenth

2020-08-08 Thread Agoua David
You Can try to use .count instead Le sam. 8 août 2020 à 17:56, N'BE SORO a écrit : > Good evening please > > Can you help me? > > I want to display the number of items with a filter. > Example: > this call returns 4 elements > {{ item.class.classecours.all|length}} > > at the .all level > make

Django jinja queryset filter lenth

2020-08-08 Thread N'BE SORO
Good evening please Can you help me? I want to display the number of items with a filter. Example: this call returns 4 elements {{ item.class.classecours.all|length}} at the .all level make an item.class.classecours.filter(status==True)|length -- You received this message because you are