Add 'password is/not null' filter to users list view.

This commit is contained in:
Lance Edgar 2016-02-01 16:11:24 -06:00
parent 0b5ec8cb56
commit d2eabccd46

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2015 Lance Edgar
# Copyright © 2010-2016 Lance Edgar
#
# This file is part of Rattail.
#
@ -24,7 +24,7 @@
User Views
"""
from __future__ import unicode_literals
from __future__ import unicode_literals, absolute_import
from sqlalchemy import orm
@ -141,6 +141,8 @@ class UsersView(MasterView):
g.filters['active'].default_verb = 'is_true'
g.filters['person'] = g.make_filter('person', model.Person.display_name, label="Person's Name",
default_active=True, default_verb='contains')
g.filters['password'] = g.make_filter('password', model.User.password,
verbs=['is_null', 'is_not_null'])
g.sorters['person'] = lambda q, d: q.order_by(getattr(model.Person.display_name, d)())
g.default_sortkey = 'username'