diff --git a/tailbone/forms/renderers/batch.py b/tailbone/forms/renderers/batch.py index 0c7034e0..76a6d5ca 100644 --- a/tailbone/forms/renderers/batch.py +++ b/tailbone/forms/renderers/batch.py @@ -40,9 +40,15 @@ class BatchIDFieldRenderer(fa.FieldRenderer): Renderer for batch ID fields. """ def render_readonly(self, **kwargs): - batch_id = self.raw_value - if batch_id: - return '{:08d}'.format(batch_id) + try: + batch_id = self.raw_value + except AttributeError: + # this can happen when creating a new batch, b/c the default value + # comes from a sequence + pass + else: + if batch_id: + return '{:08d}'.format(batch_id) return ''