MattBroach / DjangoRestMultipleModels

View (and mixin) for serializing multiple models or querysets in Django Rest Framework
MIT License
549 stars 67 forks source link

[WIP] Add the ability to apply a filter to each query #3

Closed Symmetric closed 8 years ago

Symmetric commented 8 years ago

Usecase: want to filter each queryset to a specific user_id. We don't have the user on hand at the time of view creation, so we need to pass in a function to do the filtering dynamically at runtime.

Any interest in this PR if I polish up the UTs etc? This meets my needs, so I'll not bother with tests for now unless you want to upstream this. I'm happy to work off my fork if you aren't interested in pulling in this function.

MattBroach commented 8 years ago

Hey @Symmetric: I dunno how many people are going to need this post-view-creation filtering, but I don't see any reason NOT to add it upstream -- and I'm really jazzed about the refractoring/Query model you did. I think it's a nice cleanup, generally speaking, and would be happy to have it merged. Do you want to take care of adding a couple tests to cover the new functionality before I merge, or would you prefer I take care of that myself?