Add str and repr to user model

This commit is contained in:
Tim Van Baak 2020-01-29 01:02:37 -08:00
parent a5dda4098c
commit 1068dacade

View File

@ -49,6 +49,12 @@ class UserModel(UserMixin):
raise AttributeError(key)
return self.config.get(key)
def __str__(self):
return '<UserModel {}>'.format(self.username)
def __repr__(self):
return '<UserModel uid={0.id} username={0.username}>'.format(self)
def set_password(self, pw):
h = generate_password_hash(pw)
with json_rw(self.config_path) as j: