Using complex variables in django templates -


in template below, user.group number , has shown group_name.get(user.group) there ability pass template group_name dict , use group_name.get(user.group) inside template?

<table> {% user in users %} <tr>         <td>{{ user.name }}</td>     <td>{{ user.age }}</td>     <td>{{ user.group}}</td> </tr>  {% endfor %} </table> 

in spirit of django logic should live in code, not in template. can't add method user.get_group() returns group?


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -