absent1706 / sqlalchemy-mixins

Active Record, Django-like queries, nested eager load and beauty __repr__ for SQLAlchemy
MIT License
756 stars 67 forks source link

added functionality to exclude columns after serialzation from to dict #73

Closed PrasanthChettri closed 3 years ago

PrasanthChettri commented 3 years ago

columns can be added in exclude list in the models and when we call to to_dict from the serializer mixin it filters out those columns

michaelbukachi commented 3 years ago

Hey @PrasanthChettri thanks for the PR!. Do you mind moving the __exclude__ from the model to the to_dict method. Maybe something like:

def to_dict(self, nested=False, hybrid_attributes=False, exclude=None):

This way, users won't have to touch their models.

Also, don't forget to add tests for the new functionality :smile:

PrasanthChettri commented 3 years ago

Yeah sure will do that

PrasanthChettri commented 3 years ago

I rewrote existing tests to accommodate the new change instead of adding new tests, hope that was fine