diff --git a/apps/common/utils.py b/apps/common/utils.py index d21f6b6e72..1dcceffd1e 100644 --- a/apps/common/utils.py +++ b/apps/common/utils.py @@ -315,16 +315,16 @@ def parse_range(astr): def generate_choices_w_labels(choices, display_object_type=True): results = [] for choice in choices: - ct_label = ContentType.objects.get_for_model(choice).name + ct = ContentType.objects.get_for_model(choice) label = unicode(choice) if isinstance(choice, User): label = choice.get_full_name() if choice.get_full_name() else choice if display_object_type: - verbose_name = unicode(getattr(choice._meta, u'verbose_name', ct_label)) - results.append((u'%s,%s' % (ct_label, choice.pk), u'%s: %s' % (verbose_name, label))) + verbose_name = unicode(getattr(choice._meta, u'verbose_name', ct.name)) + results.append((u'%s,%s' % (ct.model, choice.pk), u'%s: %s' % (verbose_name, label))) else: - results.append((u'%s,%s' % (ct_label, choice.pk), u'%s' % (label))) + results.append((u'%s,%s' % (ct.model, choice.pk), u'%s' % (label))) #Sort results by the label not the key value return sorted(results, key=lambda x: x[1])