def create_drop_model(field, filters: List[str]):
"""Creates and drops a model with the specified field.
Arguments:
field:
The field to include on the
model to create and drop.
filters:
List of strings to filter
SQL statements on.
"""
model = define_fake_model({'title': field})
with filtered_schema_editor(*filters) as (schema_editor, calls):
execute_migration(schema_editor, [
migrations.CreateModel(
model.__name__,
fields=[
('title', field.clone())
]
),
migrations.DeleteModel(
model.__name__,
)
])
yield calls
评论列表
文章目录