Convert departments view to master3

This commit is contained in:
Lance Edgar 2017-08-17 00:07:56 -05:00
parent 3477637c74
commit bbfa15845a
2 changed files with 7 additions and 8 deletions

View file

@ -281,6 +281,7 @@ class Form(object):
self.set_renderer(key, self.render_datetime)
elif type_ == 'boolean':
self.set_renderer(key, self.render_boolean)
self.set_widget(key, dfwidget.CheckboxWidget(true_val='True', false_val='False'))
elif type_ == 'enum':
self.set_renderer(key, self.render_enum)
elif type_ == 'codeblock':

View file

@ -31,7 +31,7 @@ import six
from rattail.db import model
from tailbone import grids
from tailbone.views import MasterView2 as MasterView, AutocompleteView
from tailbone.views import MasterView3 as MasterView, AutocompleteView
class DepartmentsView(MasterView):
@ -54,13 +54,10 @@ class DepartmentsView(MasterView):
g.set_link('number')
g.set_link('name')
def configure_fieldset(self, fs):
fs.configure(
include=[
fs.number,
fs.name,
])
return fs
def configure_form(self, f):
super(DepartmentsView, self).configure_form(f)
f.remove_field('subdepartments')
f.remove_field('employees')
def template_kwargs_view(self, **kwargs):
department = kwargs['instance']
@ -109,6 +106,7 @@ class DepartmentsView(MasterView):
url_prefix = cls.get_url_prefix()
permission_prefix = cls.get_permission_prefix()
# list by vendor
config.add_route('{}.by_vendor'.format(route_prefix), '{}/by-vendor'.format(url_prefix))
config.add_view(cls, attr='list_by_vendor', route_name='{}.by_vendor'.format(route_prefix),
permission='{}.list'.format(permission_prefix))