Ticket #8272: fieldset.diff

File fieldset.diff, 1.8 KB (added by jbowman, 7 years ago)
  • django/forms/fields.py

     
    5757    creation_counter = 0
    5858
    5959    def __init__(self, required=True, widget=None, label=None, initial=None,
    60                  help_text=None, error_messages=None):
     60                 help_text=None, error_messages=None, fieldset=None):
    6161        # required -- Boolean that specifies whether the field is required.
    6262        #             True by default.
    6363        # widget -- A Widget class, or instance of a Widget class, that should
     
    7171        # initial -- A value to use in this Field's initial display. This value
    7272        #            is *not* used as a fallback if data isn't given.
    7373        # help_text -- An optional string to use as "help text" for this Field.
     74        # fieldset -- An optional string to declare a fieldset for this Field for template purposes.
    7475        if label is not None:
    7576            label = smart_unicode(label)
    7677        self.required, self.label, self.initial = required, label, initial
     
    102103        set_class_error_messages(messages, self.__class__)
    103104        messages.update(error_messages or {})
    104105        self.error_messages = messages
     106       
     107        self.fieldset = fieldset
    105108
    106109    def clean(self, value):
    107110        """
  • django/forms/forms.py

     
    305305        else:
    306306            self.label = self.field.label
    307307        self.help_text = field.help_text or ''
    308 
     308        self.fieldset = field.fieldset or ''
     309       
    309310    def __unicode__(self):
    310311        """Renders this field as an HTML widget."""
    311312        return self.as_widget()
Back to Top