AttributeError: 'NoneType' object has no attribute 'permission'
---------------------------------------------------------------`
{% if current_user.can(Permission.MODERATE_COMMENTS) %}
File "/home/centos/Desktop/workspace/flasky_163/app/models.py", line 207, in can
def generate_email_change_token(self, new_email, expiration=3600):
s = Serializer(current_app.config['SECRET_KEY'], expiration)
return s.dumps({'change_email': self.id, 'new_email': new_email})
def can(self, permission):
return (self.role.permission & permission) == permission
def is_administrator(self):
return self.can(Permission.ADMINISTER)
def ping(self):
AttributeError: 'NoneType' object has no attribute 'permission'`
我已经添加permission进数据库了,为什么程序还是提示这个问题? 有没有已经完成flasky这个项目的前辈。指导一下呗,谢谢