Skip to content Skip to sidebar Skip to footer

How To Debug Modelmultiplechoicefield

I try to log value of ModelMultipleChoiceField logger.debug('names %s' % self.fields['names_list']) But I got 2016-08-09 17:00:19,027 DEBUG views names

Solution 1:

You can convert the ModelMultipleChoiceField to a list of strings with

selected_names = [label for value, label in self.fields['names'].choices if value in self['names'].value()]
logger.debug("names %s" % selected_names)

Post a Comment for "How To Debug Modelmultiplechoicefield"