def add_required_label_tag(original_function):
 def required_label_tag(self, contents=None, attrs=None):
  'Required label tag'
  contents = (contents or escape(self.label))
  if self.field.required:
   if (not self.label.endswith(' *')):
    self.label += ' *'
    contents += ' *'
   attrs = {'class': 'required'}
  return original_function(self, contents, attrs)
 return required_label_tag

def add_required_label_tag ( original_function ) : def required_label_tag ( self , contents = None , attrs = None ) : contents = ( contents or escape ( self . label ) ) if self . field . required : if ( not self . label . endswith ( ' *' ) ) : self . label += ' *' contents += ' *' attrs = { 'class' : 'required' } return original_function ( self , contents , attrs ) return required_label_tag
adds the required css class and an asterisks to required field labels .