def __init__(self, *args, **kwargs):
        super(CombinedFieldsMixin, self).__init__(*args, **kwargs)

        if hasattr(self, 'Meta'):

            # when subclassing a subclassed form with extra fields
            # remove those fields when the field is in exclude list
            for field_name in getattr(self.Meta, 'exclude', ()):
                if field_name in self.fields:
                    del self.fields[field_name]

            # create combined_fields
            self.combined_fields = getattr(self.Meta, 'combined_fields', [])

            # for each combination create a combined field class
            for combination in self.combined_fields:
                _label_set = []
                _css_classes_set = []
                _first_field = None

                for counter, field_name in enumerate(combination):
                    field = self.fields[field_name]
                    field.combined = { 'first': False, 'last': False }

                    #_css_classes_set.append(self[field_name].css_classes())

                    if counter == 0:
                        _first_field = field
                        field.combined['first'] = True
                    elif counter == len(combination) - 1:
                        field.combined['last'] = True

                    _label_set.append(u"%s" % field.label)

                _first_field.combined['label'] = u" + ".join(uniqify_list(_label_set, preserve_order=True))
                _first_field.combined['label'] = _first_field.combined['label']
                _first_field.combined['errors'] = ErrorDict()
                _first_field.combined['css_classes'] = ' '.join(_css_classes_set)
dataset/ETHPy150Open baskoopmans/djcommon/djcommon/forms.py/CombinedFieldsMixin.__init__/original