I am building a location tracking app where a user can be both driver and manager.
There are two different app for driver and manager. User can be both manager and driver at same time.
So, I have a model like:
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
def __init__(self, name):
self.name = name
class Driver(User):
driving_license = db.Column(db.String)
def __init__(self, driving_license):
self.driving_license)
class Manager(User):
designation = db.Column(db.String)
Is this the correct way to do it or should I design a user class and separate driver and manager class without inheriting from user class. In latter case, I can mark two flags is_driver and is_manager.
If former is correct, than how to write the init function for Driver and Manager by linking it to User class.
__init__in most cases; the default__init__takes keyword arguments and sets them on the instance.