add brands autocomplete view
This commit is contained in:
parent
78eb708a9c
commit
a64ef0e20e
|
@ -26,7 +26,8 @@
|
||||||
``rattail.pyramid.views.brands`` -- Brand Views
|
``rattail.pyramid.views.brands`` -- Brand Views
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from edbob.pyramid.views import SearchableAlchemyGridView, CrudView
|
from edbob.pyramid.views import (
|
||||||
|
SearchableAlchemyGridView, CrudView, AutocompleteView)
|
||||||
|
|
||||||
import rattail
|
import rattail
|
||||||
|
|
||||||
|
@ -81,6 +82,12 @@ class BrandCrud(CrudView):
|
||||||
return fs
|
return fs
|
||||||
|
|
||||||
|
|
||||||
|
class BrandsAutocomplete(AutocompleteView):
|
||||||
|
|
||||||
|
mapped_class = rattail.Brand
|
||||||
|
fieldname = 'name'
|
||||||
|
|
||||||
|
|
||||||
def includeme(config):
|
def includeme(config):
|
||||||
|
|
||||||
config.add_route('brands', '/brands')
|
config.add_route('brands', '/brands')
|
||||||
|
@ -88,6 +95,10 @@ def includeme(config):
|
||||||
renderer='/brands/index.mako',
|
renderer='/brands/index.mako',
|
||||||
permission='brands.list')
|
permission='brands.list')
|
||||||
|
|
||||||
|
config.add_route('brands.autocomplete', '/brands/autocomplete')
|
||||||
|
config.add_view(BrandsAutocomplete, route_name='brands.autocomplete',
|
||||||
|
renderer='json', permission='brands.list')
|
||||||
|
|
||||||
config.add_route('brand.create', '/brands/new')
|
config.add_route('brand.create', '/brands/new')
|
||||||
config.add_view(BrandCrud, attr='create', route_name='brand.create',
|
config.add_view(BrandCrud, attr='create', route_name='brand.create',
|
||||||
renderer='/brands/crud.mako',
|
renderer='/brands/crud.mako',
|
||||||
|
|
Loading…
Reference in a new issue