From 53d9d62926334ee018100104e8e293bc59ae7332 Mon Sep 17 00:00:00 2001 From: Paul Brown Date: Sat, 28 Jan 2017 02:24:37 -0600 Subject: [PATCH] use property name rather than db column name for form_choices --- flask_admin/contrib/sqla/form.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flask_admin/contrib/sqla/form.py b/flask_admin/contrib/sqla/form.py index 39d0fd3b2..cfda2e570 100644 --- a/flask_admin/contrib/sqla/form.py +++ b/flask_admin/contrib/sqla/form.py @@ -243,7 +243,7 @@ def convert(self, model, mapper, name, prop, field_args, hidden_pk): form_choices = getattr(self.view, 'form_choices', None) if mapper.class_ == self.view.model and form_choices: - choices = form_choices.get(column.key) + choices = form_choices.get(prop.key) if choices: return form.Select2Field( choices=choices, @@ -537,7 +537,7 @@ def process_ajax_refs(self, info): def _calculate_mapping_key_pair(self, model, info): """ Calculate mapping property key pair between `model` and inline model, - including the forward one for `model` and the reverse one for inline model. + including the forward one for `model` and the reverse one for inline model. Override the method to map your own inline models. :param model: