db.backends.base.schema.BaseDatabaseSchemaEditor.add_field()

BaseDatabaseSchemaEditor.add_field(model, field) [source]

Adds a column (or sometimes multiple) to the model’s table to represent the field. This will also add indexes or a unique constraint if the field has db_index=True or unique=True.

If the field is a ManyToManyField without a value for through, instead of creating a column, it will make a table to represent the relationship. If through is provided, it is a no-op.

If the field is a ForeignKey, this will also add the foreign key constraint to the column.

doc_Django
2016-10-09 18:35:06
Comments
Leave a Comment

Please login to continue.