i am building a web application. i have the following model.
class Staff(db.Model):
id = db.Column(db.Integer, primary_key=True)
store_id = db.Column(db.Integer, db.ForeignKey('store.id'))
first_name = db.Column(db.String(64))
last_name = db.Column(db.String(64))
username = db.Column(db.String(64))
cell_phone = db.Column(db.Integer)
email = db.Column(db.String(64))
position = db.Column(db.String(64))
# add average salary value based on payroll
i want the username
to be first_name+last_name
with the user typing only his first and last name in the form.
i know how to use @db.event.listens_for(Staff, "after_insert")
etc and update it like that. But is there a way to define something within the model so it does it automatically without a triger?
`