Closed josejachuf closed 3 years ago
@josejachuf you can call define_models
how many times you prefer, just define auth models ancestors before, eg:
db.define_models(MyModel)
auth = Auth(app, db, user_model=User)
db.define_models(AnotherModel)
Note: you don't need to define
User
model on the database since theAuth
module takes care of it.
Awesome, I didn't know you could do that.
Thanks @gi0baro
Hi,
How can I define a FK field with belongs_to in User model
The problem is that any class (Model) does not exist before User
I get: AttributeError: 'Database' object has no attribute 'Mymodel'
And if I change the order of definition I get:
AttributeError: 'Database' object has no attribute 'User'
Best Regards Jose