From 177d9d2e3d982233beb4bfbc3b8b11545453dad7 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 9 May 2018 15:12:44 -0500 Subject: [PATCH] Fix label profile type field when editing label batch row --- tailbone/views/labels/batch.py | 14 ++++++++++++++ tailbone/views/master.py | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tailbone/views/labels/batch.py b/tailbone/views/labels/batch.py index acf33d9e..414811f4 100644 --- a/tailbone/views/labels/batch.py +++ b/tailbone/views/labels/batch.py @@ -26,10 +26,13 @@ Views for label batches from __future__ import unicode_literals, absolute_import +import six + from rattail.db import model from webhelpers2.html import HTML, tags +from tailbone import forms from tailbone.views.batch import BatchMasterView @@ -181,6 +184,17 @@ class LabelBatchView(BatchMasterView): else: f.remove_field('product') + # label_profile + if self.editing: + f.replace('label_profile', 'label_profile_uuid') + f.set_label('label_profile_uuid', "Label Type") + profiles = self.Session.query(model.LabelProfile)\ + .filter(model.LabelProfile.visible == True)\ + .order_by(model.LabelProfile.ordinal) + profile_values = [(p.uuid, six.text_type(p)) + for p in profiles] + f.set_widget('label_profile_uuid', forms.widgets.JQuerySelectWidget(values=profile_values)) + def includeme(config): LabelBatchView.defaults(config) diff --git a/tailbone/views/master.py b/tailbone/views/master.py index b727e426..c6e8db19 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -2450,7 +2450,9 @@ class MasterView(View): 'parent_instance': parent, 'instance_title': self.get_row_instance_title(row), 'instance_deletable': self.row_deletable(row), - 'form': form}) + 'form': form, + 'dform': form.make_deform_form(), + }) def mobile_edit_row(self): """