Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AccountViewMixin(object):
- """
- Modifies the queryset by filtering out objects not belonging to the user's account
- """
- model = None
- def get_queryset(self):
- account = self.request.user.get_profile().account
- return self.model._default_manager.by_account(account).all()
- class AccountListView(ListView, AccountViewMixin):
- model = ModelNAme
- template...
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement