I am working on a Flask project. I have 2 models, user and status. These are in separate folders with code like so,
class Status(object):
def __init__(self, username , email, biography, interests, about, user_id, block_status=False, _id=None):
self.username = username
self.email = email
self.biography = biography
self.interests = interests
self.about = about
self.user_id = user_id
self.block_status = block_status
self._id = uuid.uuid4().hex if _id is None else _id
and
class User(object):
def __init__(self, first_name, last_name, username, email, password, _id=None):
self.first_name = first_name
self.last_name = last_name
self.username = username
self.email = email
self.password = password
self._id = uuid.uuid4().hex if _id is None else _id
I want the user model to share the id attribute to status model. I have tried my way but it did not work.
question from:
https://stackoverflow.com/questions/66052537/sharing-data-between-models 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…