关于AttributeError: 'TaggableRel' object has no attribute 'related_query_name'

if self.remote_field.related_query_name is not None:
AttributeError: 'TaggableRel' object has no attribute 'related_query_name'
关于如上错误是由于django-taggit 在 django 2.0版本上不兼容导致到,解决方案找到taggit包下的managers.py文件修改TaggableRel类.添加一行self.related_query_name = None便可以解决.
class TaggableRel(ManyToManyRel):
    def __init__(self, field, related_name, through, to=None, ):
        # rel.to renamed to rel.model in Django 1.9
        if VERSION >= (1, 9):
            self.model = to
        else:
            self.to = to
        self.related_name = related_name
        self.limit_choices_to = {}
        self.symmetrical = True
        self.multiple = True
        self.through = through
        self.field = field
        self.through_fields = None