Example #1
0
 def valid_value(self, value):
     text_value = force_text(value)
     for k, v in self.choices:
         if isinstance(k, type):
             k = classpath(k)
         if value == k or text_value == force_text(k):
             return True
     return False
Example #2
0
    def _set_choices(self, value):
        choices = list(value)
        self._choices = choices

        text_choices = [(classpath(subclass) if subclass else subclass, name)
                        for subclass, name in choices]

        self.widget.choices = text_choices
Example #3
0
 def valid_value(self, value):
     text_value = force_text(value)
     for k, v in self.choices:
         if isinstance(k, type):
             k = classpath(k)
         if value == k or text_value == force_text(k):
             return True
     return False
Example #4
0
    def _set_choices(self, value):
        choices = list(value)
        self._choices = choices

        text_choices = [(
            classpath(subclass) if subclass else subclass,
            name
        ) for subclass, name in choices]

        self.widget.choices = text_choices
Example #5
0
 def get_context(self, name, value, attrs):
     value = classpath(value)
     context = super(DashboardSelect, self).get_context(name, value, attrs)
     return context
Example #6
0
 def render(self, name, value, attrs=None, choices=()):
     value = classpath(value)
     return super(DashboardSelect, self).render(
         name, value, attrs, choices)
Example #7
0
 def render(self, name, value, attrs=None, choices=()):
     value = classpath(value)
     return super(DashboardSelect, self).render(name, value, attrs, choices)