Add basic str() method for WorkedShift model

This commit is contained in:
Lance Edgar 2017-02-04 12:25:57 -06:00
parent c182ee80e2
commit de61364c8e
2 changed files with 8 additions and 1 deletions

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -26,6 +26,8 @@ Data models for employee work shifts
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
import six
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
@ -111,6 +113,7 @@ class ScheduledShift(Base, ShiftMixin):
""") """)
@six.python_2_unicode_compatible
class WorkedShift(Base, ShiftMixin): class WorkedShift(Base, ShiftMixin):
""" """
Represents a shift actually *worked* by an employee. (Either ``punch_in`` Represents a shift actually *worked* by an employee. (Either ``punch_in``
@ -159,3 +162,6 @@ class WorkedShift(Base, ShiftMixin):
# 'punch' columns at some point..? # 'punch' columns at some point..?
start_time = orm.synonym('punch_in') start_time = orm.synonym('punch_in')
end_time = orm.synonym('punch_out') end_time = orm.synonym('punch_out')
def __str__(self):
return unicode(self.employee or '')

View file

@ -66,6 +66,7 @@ requires = [
'humanize', # 0.5.1 'humanize', # 0.5.1
'lockfile', # 0.9.1 'lockfile', # 0.9.1
'progressbar', # 2.3 'progressbar', # 2.3
'six', # 1.10.0
# TODO: make FormEncode optional? only used for email validator # TODO: make FormEncode optional? only used for email validator
# For now, let's restrict FormEncode to 1.2 since the 1.3 release # For now, let's restrict FormEncode to 1.2 since the 1.3 release