gothinkster / flask-realworld-example-app

Exemplary real world JSON API built with Flask (Python)
https://realworld.io/
MIT License
897 stars 308 forks source link

CRUD Mixin #3

Closed rustanacexd closed 7 years ago

rustanacexd commented 7 years ago

Is there any reason you are not using the popular CRUD mixin? or its because of the rollbacks on your views? i'm learning your codebase and its very similar to https://github.com/sloria/cookiecutter-flask and they use that mixin i'm just wondering.

see screenshot http://take.ms/E17UT

realazizk commented 7 years ago

I'm gonna close this but we can use this thread to chat, the model_class is indeed CRUDMixin https://github.com/gothinkster/flask-realworld-example-app/blob/master/conduit/extensions.py#L12 I'm passing it to the as a model_class since you can change the declarative base class, I'm doing this so that I don't have to inherit from CRUDMixin every time (see this https://github.com/gothinkster/flask-realworld-example-app/blob/master/conduit/database.py#L11) generally you don't want to use that mixin, sqlalchemy follows the data mapper pattern we are making it behave like an active record which is not a very good idea, and yes I generated the project skeleton with sloria's cookiecutter.

rustanacexd commented 7 years ago

gotcha! thank you for the response, best flask codebase on api i've seen so far