Exemplo n.º 1
0
	def render(self, name, value, attrs=None, choices=()):
		d  = self._build_base_dict(name, value, attrs)
		if len(choices) > 0:
			d['source'] = mark_safe(u'[%s]' %
					u','.join((u'{"val":"%s","label":"%s"}' %
					(esc(i[0]), esc(i[1])) for i in choices)))
		else:
			d['source'] = u'[]'
		return render_to_string(self.template, d)
Exemplo n.º 2
0
	def render(self, name, value, attrs=None, choices=()):
		d  = self._build_base_dict(name, value, attrs)
		if len(choices) > 0:
			d['source'] = mark_safe(u'[%s]' %
					u','.join((u'{"val":"%s","label":"%s"}' %
					(esc(i[0]), esc(i[1])) for i in choices)))
		else:
			d['source'] = u'[]'
		return render_to_string(self.template, d)
Exemplo n.º 3
0
	def build_jqw_attrs(self, extra_attrs=None, value=None, **kwargs):
		final_attrs = self.build_attrs(extra_attrs, **kwargs)
		final_attrs['id'] += '_jqw'
		final_attrs['type'] = self.jqw_input_type
		jqw_value = self._get_jqw_value(value)
		if jqw_value != '' and self.jqw_input_type == 'text':
			final_attrs['value'] = esc(jqw_value)
		return final_attrs
Exemplo n.º 4
0
	def build_jqw_attrs(self, extra_attrs=None, value=None, **kwargs):
		final_attrs = self.build_attrs(extra_attrs, **kwargs)
		final_attrs['id'] += '_jqw'
		final_attrs['type'] = self.jqw_input_type
		jqw_value = self._get_jqw_value(value)
		if jqw_value != '' and self.jqw_input_type == 'text':
			final_attrs['value'] = esc(jqw_value)
		return final_attrs