From 8ced5d4e8a6a95132298b620145ae00f186230c7 Mon Sep 17 00:00:00 2001 From: Brandon Bell Date: Wed, 10 Feb 2021 16:44:08 -0600 Subject: [PATCH] Handle hierarchical choices in get_%s_display() Bring the contributed method in line with Django's CharField.get_FOO_display() to handle named groups/categories --- multiselectfield/db/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multiselectfield/db/fields.py b/multiselectfield/db/fields.py index 7d4eef6..65cf8ab 100644 --- a/multiselectfield/db/fields.py +++ b/multiselectfield/db/fields.py @@ -160,7 +160,7 @@ def contribute_to_class(self, cls, name): if self.choices: def get_list(obj): fieldname = name - choicedict = dict(self.choices) + choicedict = dict(self.flatchoices) display = [] if getattr(obj, fieldname): for value in getattr(obj, fieldname):