Skip to content
This repository was archived by the owner on May 20, 2018. It is now read-only.

Commit e2b463d

Browse files
author
Lev Lazinskiy
committed
[BUGFIX] Fixed Avatar Hashing and User __init__ Model
1 parent 963702d commit e2b463d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/models.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ class User(UserMixin, db.Model):
3737
updated_date = db.Column(db.DateTime(), default=datetime.utcnow)
3838
notes = db.relationship('Note', backref='author', lazy='dynamic')
3939

40-
# def __init__(self, **kwargs):
41-
# if self.email is not None and self.avatar_hash is None:
42-
# self.avatar_hash = hashlib.md5(
43-
# self.email.encode('utf-8')).hexdigest()
40+
def __init__(self, **kwargs):
41+
super(User, self).__init__(**kwargs)
42+
if self.email is not None and self.avatar_hash is None:
43+
self.avatar_hash = hashlib.md5(
44+
self.email.encode('utf-8')).hexdigest()
4445

4546
@property
4647
def password(self):

0 commit comments

Comments
 (0)