django by example 第三章报错:
@register.assignment_tag
AttributeError: ‘Library’ object has no attribute ‘assignment_tag’
AttributeError: 'Library' object has no attribute 'assignment_tag'
You may be seeing this error after upgrading to Django 2.0. This is because assignment_tag was deprecated in Django 1.9, and removed in Django 2.0:
Django 1.4 added the
assignment_taghelper to ease the creation of template tags that store results in a template variable. Thesimple_tag()helper has gained this same ability, making theassignment_tagobsolete. Tags that useassignment_tagshould be updated to usesimple_tag.from: https://blog.csdn.net/maizhaoxi/article/details/82719072
