15
Django 1.10.1'my_templatetag'不是注册的标签库。必须是以下之一:
我想要一个菜单,可以根据您所属的组进行定制。我正在使用Django 1.10.1,allauth等。当我试图使我的templatetag失败时,它说: TemplateSyntaxError at / 'my_templatetag' is not a registered tag library. Must be one of: account account_tags admin_list admin_modify admin_static admin_urls cache i18n l10n log socialaccount socialaccount_tags static staticfiles tz “ my_templatetag.py”看起来像这样: from django import template from django.contrib.auth.models import Group register = template.Library() @register.filter(name='has_group') def has_group(user, group_name): group = …