def __iter__(self): if self.empty: yield '', u'-- None --' query = DBSession.query(User.id, User.name)\ .filter(not_(User.is_client()))\ .filter(User.is_active==True)\ .order_by(User.name) for id, name in query: yield str(id), name if self.inactive: yield '', ' ' * 8 query = DBSession.query(User.id, User.name)\ .filter(User.is_client())\ .filter(User.is_active==False)\ .order_by(User.name) for id, name in query: yield str(id), name
def __iter__(self): if self.empty: yield '', u'-- None --' query = DBSession.query(User.id, User.name)\ .filter(not_(User.is_client()))\ .filter(User.is_active==True)\ .order_by(User.name) for id, name in query: yield str(id), name if self.inactive: yield '', ' '*8 query = DBSession.query(User.id, User.name)\ .filter(User.is_client())\ .filter(User.is_active==False)\ .order_by(User.name) for id, name in query: yield str(id), name
def get(self): res = User.query.filter(User.is_active == True).filter(User.is_not_client()).order_by(User.name).all() users = [user for user in res if not user.freelancer] freelancers = [user for user in res if user.freelancer] clients = [] if self.request.has_perm("admin"): clients = User.query.filter(User.is_active == True).filter(User.is_client()).order_by(User.name).all() return dict(users=users, freelancers=freelancers, clients=clients)
def __iter__(self): if self.empty: yield "", u"-- None --" query = ( self.session.query(User.id, User.name) .filter(not_(User.is_client())) .filter(User.is_active == True) .order_by(User.name) ) for id, name in query: yield str(id), name if self.inactive: yield "", " " * 8 query = ( self.session.query(User.id, User.name) .filter(User.is_client()) .filter(User.is_active == False) .order_by(User.name) ) for id, name in query: yield str(id), name
def get(self): users = User.query.filter(User.is_active==True)\ .filter(User.is_not_client())\ .filter(User.freelancer==False)\ .order_by(User.name).all() freelancers = User.query.filter(User.is_active==True)\ .filter(User.is_not_client())\ .filter(User.freelancer==True)\ .order_by(User.name).all() clients = [] if self.request.has_perm('admin'): clients = User.query.filter(User.is_active==True)\ .filter(User.is_client())\ .order_by(User.name).all() return dict( users=users, freelancers=freelancers, clients=clients, )
def get(self): users = User.query.filter(User.is_active==True)\ .filter(User.is_not_client())\ .filter(User.freelancer==False)\ .order_by(User.name).all() freelancers = User.query.filter(User.is_active==True)\ .filter(User.is_not_client())\ .filter(User.freelancer==True)\ .order_by(User.name).all() clients = [] if self.request.has_perm('admin'): clients = User.query.filter(User.is_active==True)\ .filter(User.is_client())\ .order_by(User.name).all() return dict( users=users, freelancers=freelancers, clients=clients, )