How do I get the correct id from flask-sqlalchemy when autoincrement id from def init() in flask-sqlalchemy ?Also if I want to db.add(id) id how do I do that?
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
hashed_password = db.Column(db.String(128), nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
confirmation_email = db.Column(db.Boolean, default=False, nullable=False)
reset_email_password = db.Column(db.Boolean, default=False, nullable=False)
def __init__ (self , id: int, username: str, email: str, plaintext_password: str, confirmation_email=False, reset_email_password=False):
self.id = id
self.username = username
self.email = email
# Hashing the password ( bytes, salt)
plaintext_password = 'pojkp[kjpj[pj'
self.hashed_password = bcrypt.hashpw(plaintext_password.encode('utf-8'), bcrypt.gensalt())
self.confirmation_email = confirmation_email
self.reset_email_password = reset_email_password
Thanks for the help