Make GPCFieldRenderer display check digit separate from main barcode data.

It is presumed that this is a good idea in general; I guess we'll see.
This commit is contained in:
Lance Edgar 2014-11-18 19:36:55 -06:00
parent fa9cef9636
commit 2326482bb6

View file

@ -20,7 +20,6 @@
# along with Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
"""
Product Field Renderers
"""
@ -64,6 +63,13 @@ class GPCFieldRenderer(TextFieldRenderer):
# Hm, should maybe consider hard-coding this...?
return len(str(GPC(0)))
def render_readonly(self, **kwargs):
gpc = self.raw_value
if gpc is None:
return ''
gpc = unicode(gpc)
return '{0}-{1}'.format(gpc[:-1], gpc[-1])
class BrandFieldRenderer(AutocompleteFieldRenderer):
"""