def choices_for(self, property): if self.choicelist: return get_choicelist(self.choicelist).get_choices() return [ (pc.value, pc.text) for pc in PropChoice.objects.filter(type=self).order_by('value') ]
def get_text_for_value(self, value): if not value: return '' if self.choicelist: cl = get_choicelist(self.choicelist) return cl.get_text_for_value(value) l = [] for v in value.split(MULTIPLE_VALUES_SEP): try: pc = PropChoice.objects.get(value=v, type=self) v = dd.babelattr(pc, 'text') except PropChoice.DoesNotExist: pass l.append(v) return ','.join(l)
def choices_for(self, property): if self.choicelist: return get_choicelist(self.choicelist).get_choices() return [(pc.value, pc.text) for pc in PropChoice.objects.filter(type=self).order_by('value')]
def default_value_choices(cls, choicelist): if choicelist: return get_choicelist(choicelist).get_choices() return []