add departments autocomplete view
This commit is contained in:
parent
a64ef0e20e
commit
6d7732b34a
|
@ -27,7 +27,8 @@
|
|||
"""
|
||||
|
||||
|
||||
from edbob.pyramid.views import SearchableAlchemyGridView, AlchemyGridView
|
||||
from edbob.pyramid.views import (
|
||||
SearchableAlchemyGridView, AlchemyGridView, AutocompleteView)
|
||||
|
||||
import rattail
|
||||
|
||||
|
@ -87,6 +88,12 @@ class DepartmentsByVendorGrid(AlchemyGridView):
|
|||
return g
|
||||
|
||||
|
||||
class DepartmentsAutocomplete(AutocompleteView):
|
||||
|
||||
mapped_class = rattail.Department
|
||||
fieldname = 'name'
|
||||
|
||||
|
||||
def includeme(config):
|
||||
|
||||
config.add_route('departments', '/departments')
|
||||
|
@ -94,6 +101,10 @@ def includeme(config):
|
|||
renderer='/departments/index.mako',
|
||||
permission='departments.list')
|
||||
|
||||
config.add_route('departments.autocomplete', '/departments/autocomplete')
|
||||
config.add_view(DepartmentsAutocomplete, route_name='departments.autocomplete',
|
||||
renderer='json', permission='departments.list')
|
||||
|
||||
config.add_route('departments.by_vendor', '/departments/by-vendor')
|
||||
config.add_view(DepartmentsByVendorGrid, route_name='departments.by_vendor',
|
||||
permission='departments.list')
|
||||
|
|
Loading…
Reference in a new issue