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
Post a Comment