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.
本文解析了在升级到Django2.0后遇到的'Library'对象没有'assignment_tag'属性的错误。从Django1.9开始,assignment_tag已被废弃,并在Django2.0中移除。文章详细介绍了如何将使用assignment_tag的模板标签更新为使用simple_tag。
65

被折叠的 条评论
为什么被折叠?



