From 765fa7f949b3d90c9b5f58ce922e1cc17374b271 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 26 Nov 2012 16:27:18 -0800 Subject: [PATCH] use default_format when saving label profiles --- rattail/pyramid/views/labels.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rattail/pyramid/views/labels.py b/rattail/pyramid/views/labels.py index 92d7eb2f..931cb14e 100644 --- a/rattail/pyramid/views/labels.py +++ b/rattail/pyramid/views/labels.py @@ -114,6 +114,16 @@ class ProfileCrud(CrudView): ]) return fs + def post_save(self, form): + profile = form.fieldset.model + if not profile.format: + formatter = profile.get_formatter() + if formatter: + try: + profile.format = formatter.default_format + except NotImplementedError: + pass + def post_save_url(self, form): return self.request.route_url('label_profile.read', uuid=form.fieldset.model.uuid)