Add master views for ScheduledShift model

This commit is contained in:
Lance Edgar 2016-04-28 18:16:26 -05:00
parent b02f7a9a2b
commit fb25f6917e

View file

@ -51,6 +51,35 @@ class ShiftLengthField(formalchemy.Field):
return humanize.naturaldelta(shift.punch_out - shift.punch_in)
class ScheduledShiftsView(MasterView):
"""
Master view for employee scheduled shifts.
"""
model_class = model.ScheduledShift
url_prefix = '/shifts/scheduled'
def configure_grid(self, g):
g.default_sortkey = 'start_time'
g.default_sortdir = 'desc'
g.configure(
include=[
g.employee,
g.store,
g.start_time,
g.end_time,
],
readonly=True)
def configure_fieldset(self, fs):
fs.configure(
include=[
fs.employee,
fs.store,
fs.start_time,
fs.end_time,
])
class WorkedShiftsView(MasterView):
"""
Master view for employee worked shifts.
@ -85,4 +114,5 @@ class WorkedShiftsView(MasterView):
def includeme(config):
ScheduledShiftsView.defaults(config)
WorkedShiftsView.defaults(config)