Advertisement
Guest User

Untitled

a guest
May 6th, 2012
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. class AccountViewMixin(object):
  2.     """
  3.    Modifies the queryset by filtering out objects not belonging to the user's account
  4.    """
  5.     model = None
  6.  
  7.     def get_queryset(self):
  8.         account = self.request.user.get_profile().account
  9.         return self.model._default_manager.by_account(account).all()
  10.  
  11. class AccountListView(ListView, AccountViewMixin):
  12.     model = ModelNAme
  13.     template...
  14.     ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement