tko22 / flask-boilerplate

Simple flask boilerplate with Postgres, Docker, and Heroku/Zeit now
https://github.com/tko22/flask-boilerplate/wiki
MIT License
301 stars 98 forks source link

Create Model_id_recursion.py #22

Closed yoann9344 closed 5 years ago

yoann9344 commented 5 years ago

I have achieved the perfect recursion without using depth. We should using it at the creation of the database : db = SQLAlchemy(app, model_class=MyModel) Cause with we use a mixin and we forgot to use it, if an a class with mixin has a relationship with one without mixin it will create a complicate bug. And this because we do this test : if issubclass(type(attribute), MyModel) so if MyModel is a mixin, we might skip the recursive and send back a dict with an object inside !

yoann9344 commented 5 years ago

I have done all modifications there : https://github.com/yoann9344/flask-boilerplate/blob/master/api/ORM/Model.py

tko22 commented 5 years ago

nice! could you push the new changes to the branch this PR is on?

yoann9344 commented 5 years ago

That's done