Convert customer groups view to master3
This commit is contained in:
parent
7dbdaf1f8a
commit
2448d71edd
|
@ -29,7 +29,7 @@ from __future__ import unicode_literals, absolute_import
|
||||||
from rattail.db import model
|
from rattail.db import model
|
||||||
|
|
||||||
from tailbone.db import Session
|
from tailbone.db import Session
|
||||||
from tailbone.views import MasterView2 as MasterView
|
from tailbone.views import MasterView3 as MasterView
|
||||||
|
|
||||||
|
|
||||||
class CustomerGroupsView(MasterView):
|
class CustomerGroupsView(MasterView):
|
||||||
|
@ -38,23 +38,28 @@ class CustomerGroupsView(MasterView):
|
||||||
"""
|
"""
|
||||||
model_class = model.CustomerGroup
|
model_class = model.CustomerGroup
|
||||||
model_title = "Customer Group"
|
model_title = "Customer Group"
|
||||||
|
|
||||||
|
labels = {
|
||||||
|
'id': "ID",
|
||||||
|
}
|
||||||
|
|
||||||
grid_columns = [
|
grid_columns = [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
form_fields = [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
]
|
||||||
|
|
||||||
def configure_grid(self, g):
|
def configure_grid(self, g):
|
||||||
|
super(CustomerGroupsView, self).configure_grid(g)
|
||||||
g.filters['name'].default_active = True
|
g.filters['name'].default_active = True
|
||||||
g.filters['name'].default_verb = 'contains'
|
g.filters['name'].default_verb = 'contains'
|
||||||
g.default_sortkey = 'name'
|
g.default_sortkey = 'name'
|
||||||
g.set_label('id', "ID")
|
g.set_link('id')
|
||||||
|
g.set_link('name')
|
||||||
def configure_fieldset(self, fs):
|
|
||||||
fs.configure(
|
|
||||||
include=[
|
|
||||||
fs.id.label("ID"),
|
|
||||||
fs.name,
|
|
||||||
])
|
|
||||||
|
|
||||||
def before_delete(self, group):
|
def before_delete(self, group):
|
||||||
# First remove customer associations.
|
# First remove customer associations.
|
||||||
|
|
Loading…
Reference in a new issue