Exemple #1
0
 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')
     ]
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #4
0
 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')]
Exemple #5
0
 def default_value_choices(cls, choicelist):
     if choicelist:
         return get_choicelist(choicelist).get_choices()
     return []
Exemple #6
0
 def default_value_choices(cls, choicelist):
     if choicelist:
         return get_choicelist(choicelist).get_choices()
     return []