在Django中如何在视图中创建fixture?
正如标题所说,是否有可能在Django的视图中创建数据固定值(fixtures)呢?
非常感谢!
1 个回答
1
你可以在你的视图中使用 call_command
来调用 dumpdata
(详细说明可以查看这里:https://docs.djangoproject.com/en/dev/ref/django-admin/#running-management-commands-from-your-code)。