Ticket #5216: label_tag.5.patch
File label_tag.5.patch, 1.6 KB (added by , 16 years ago) |
---|
-
django/forms/forms.py
371 371 """ 372 372 contents = contents or escape(self.label) 373 373 widget = self.field.widget 374 id_ = widget.attrs.get('id') or self.auto_id374 id_ = smart_unicode(widget.attrs.get('id', '')) or self.auto_id 375 375 if id_: 376 376 attrs = attrs and flatatt(attrs) or '' 377 377 contents = '<label for="%s"%s>%s</label>' % (widget.id_for_label(id_), attrs, contents) -
tests/regressiontests/forms/regressions.py
34 34 u'<p><label for="id_username">Nazwa u\u017cytkownika:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p>' 35 35 >>> deactivate() 36 36 37 There was some problems with form translations in #5216 38 >>> class SomeForm(Form): 39 ... field_1 = CharField(max_length=10, label=ugettext_lazy('field_1')) 40 ... field_2 = CharField(max_length=10, label=ugettext_lazy('field_2'), widget=TextInput(attrs={'id': 'field_2_id'})) 41 >>> f = SomeForm() 42 >>> print f['field_1'].label_tag() 43 <label for="id_field_1">field_1</label> 44 >>> print f['field_2'].label_tag() 45 <label for="field_2_id">field_2</label> 46 37 47 Unicode decoding problems... 38 48 >>> GENDERS = ((u'\xc5', u'En tied\xe4'), (u'\xf8', u'Mies'), (u'\xdf', u'Nainen')) 39 49 >>> class SomeForm(Form):