Add "active" filter to users view; enable it by default.

This commit is contained in:
Lance Edgar 2014-08-05 21:23:55 -07:00
parent dcc1699f69
commit 16bba17e83

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2012 Lance Edgar # Copyright © 2010-2014 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -26,6 +25,8 @@
User Views User Views
""" """
from __future__ import unicode_literals
from formalchemy import Field from formalchemy import Field
from formalchemy.fields import SelectFieldRenderer from formalchemy.fields import SelectFieldRenderer
@ -40,6 +41,8 @@ from rattail.db.auth import guest_role
from webhelpers.html import tags from webhelpers.html import tags
from webhelpers.html import HTML from webhelpers.html import HTML
from tailbone.grids.search import BooleanSearchFilter
class UsersGrid(SearchableAlchemyGridView): class UsersGrid(SearchableAlchemyGridView):
@ -56,6 +59,7 @@ class UsersGrid(SearchableAlchemyGridView):
def filter_map(self): def filter_map(self):
return self.make_filter_map( return self.make_filter_map(
ilike=['username'], ilike=['username'],
exact=['active'],
person=self.filter_ilike(Person.display_name)) person=self.filter_ilike(Person.display_name))
def filter_config(self): def filter_config(self):
@ -63,7 +67,11 @@ class UsersGrid(SearchableAlchemyGridView):
include_filter_username=True, include_filter_username=True,
filter_type_username='lk', filter_type_username='lk',
include_filter_person=True, include_filter_person=True,
filter_type_person='lk') filter_type_person='lk',
filter_factory_active=BooleanSearchFilter,
include_filter_active=True,
filter_type_active='is',
active='True')
def sort_map(self): def sort_map(self):
return self.make_sort_map( return self.make_sort_map(