set user object id after created

This commit is contained in:
CMGS 2016-08-23 10:52:35 +08:00
parent 8e58999f5a
commit 4a3c4b53cc

View File

@ -268,6 +268,7 @@ class User(db.Model):
user = User(username=self.username, firstname=self.firstname, lastname=self.lastname, role_id=self.role_id, email=self.email, password=self.get_hashed_password(self.plain_text_password))
db.session.add(user)
db.session.commit()
self.id = user.id
return True
except Exception, e:
raise