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
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
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
def get_context(self, name, value, attrs): value = classpath(value) context = super(DashboardSelect, self).get_context(name, value, attrs) return context
def render(self, name, value, attrs=None, choices=()): value = classpath(value) return super(DashboardSelect, self).render( name, value, attrs, choices)
def render(self, name, value, attrs=None, choices=()): value = classpath(value) return super(DashboardSelect, self).render(name, value, attrs, choices)