def render(self, name, value, attrs=None): if attrs is None: attrs = {} attrs['type'] = 'hidden' klass = add_to_css_class(self.attrs.pop('class', ''), 'uneditable-input') klass = add_to_css_class(klass, attrs.pop('class', '')) base = super(Uneditable, self).render(name, value, attrs) if not isinstance(value, list): value = [value] if self.value_calback: if not hasattr(self, 'choices') or isinstance(self.choices, list): value = self.value_calback(None, value) else: value = self.value_calback(self.choices.queryset, value) if isinstance(value, list): if not value: value = u'<span class="%s" style="color: #555555; background-color: #eeeeee;" disabled="true"></span>' % klass else: value = u''.join( u'<span class="%s" style="color: #555555; background-color: #eeeeee;" disabled="true">%s</span>' % (klass, val) for val in value) else: value = u'<span class="%s" style="color: #555555; background-color: #eeeeee;" disabled="true">%s</span>' % ( klass, value) return mark_safe(base + value)
def render(self, name, value, attrs=None): if attrs is None: attrs = {} attrs['class'] = add_to_css_class(attrs.get('class', ''), 'time-field input-small') attrs['data-format'] = javascript_time_format(self.format) return super(BootstrapTimeInput, self).render(name, value, attrs)
def render(self, name, value, attrs=None): if attrs is None: attrs = {} attrs['class'] = add_to_css_class(attrs.get('class', ''), 'date-field') attrs['data-format'] = ' '.join([ javascript_date_format(self.format), javascript_time_format(self.format) ]) return super(BootstrapDateTimeInput, self).render(name, value, attrs)
def render(self, name, value, attrs=None): if attrs is None: attrs = {} attrs['type'] = 'hidden' klass = add_to_css_class(self.attrs.pop('class', ''), 'uneditable-input') klass = add_to_css_class(klass, attrs.pop('class', '')) base = super(Uneditable, self).render(name, value, attrs) if not isinstance(value, list): value = [value] if self.value_calback: if not hasattr(self, 'choices') or isinstance(self.choices, list): value = self.value_calback(None, value) else: value = self.value_calback(self.choices.queryset, value) if isinstance(value,list): if not value: value = u'<span class="%s" style="color: #555555; background-color: #eeeeee;" disabled="true"></span>' % klass else: value = u''.join(u'<span class="%s" style="color: #555555; background-color: #eeeeee;" disabled="true">%s</span>' % (klass, val) for val in value) else: value = u'<span class="%s" style="color: #555555; background-color: #eeeeee;" disabled="true">%s</span>' % (klass, value) return mark_safe(base + value)
def render(self, name, value, attrs=None): if attrs is None: attrs = {} attrs['class'] = add_to_css_class(attrs.get('class', ''), 'date-field') attrs['data-format'] = ' '.join([javascript_date_format(self.format), javascript_time_format(self.format)]) return super(BootstrapDateTimeInput, self).render(name, value, attrs)