How to check (in template) if user belongs to a group

后端 未结 9 1869
广开言路
广开言路 2020-12-07 20:38

How to check in template whether user belongs to some group?

It is possible in a view which is generating the template but what if I want

9条回答
  •  情歌与酒
    2020-12-07 20:50

    Although the answer given by mishbah is right but it didn't work for me.

    I am using Django 2.2.7 and i figured out that register = template.Library() should be replaced with from django.template.defaultfilters import register.

    i hope someone will find it useful.

提交回复
热议问题