~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to django/forms/forms.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2013-08-13 16:49:39 UTC
  • mfrom: (1.3.9)
  • mto: This revision was merged to the branch mainline in revision 47.
  • Revision ID: package-import@ubuntu.com-20130813164939-irlkd7hokvcgocfl
Tags: upstream-1.5.2
ImportĀ upstreamĀ versionĀ 1.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
503
503
 
504
504
        If attrs are given, they're used as HTML attributes on the <label> tag.
505
505
        """
506
 
        contents = contents or conditional_escape(self.label)
 
506
        contents = contents or self.label
507
507
        widget = self.field.widget
508
508
        id_ = widget.attrs.get('id') or self.auto_id
509
509
        if id_:
511
511
            contents = format_html('<label for="{0}"{1}>{2}</label>',
512
512
                                   widget.id_for_label(id_), attrs, contents
513
513
                                   )
 
514
        else:
 
515
            contents = conditional_escape(contents)
514
516
        return mark_safe(contents)
515
517
 
516
518
    def css_classes(self, extra_classes=None):