

def add_field(self, field):
    self.remove_field(field.name)
    self.fields[field.name] = field
    self.columns[field.db_column] = field
    self._sorted_field_list.insert(field)
    self.sorted_fields = list(self._sorted_field_list)
    self.sorted_field_names = [f.name for f in self.sorted_fields]
    if (field.default is not None):
        self.defaults[field] = field.default
        if callable(field.default):
            self._default_callables[field] = field.default
            self._default_callable_list.append((field.name, field.default))
        else:
            self._default_dict[field] = field.default
            self._default_by_name[field.name] = field.default

dataset/ETHPy150Open coleifer/peewee/peewee.py ModelOptions.add_field/original