Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 默认值';使用';模型中_Python_Django_Django Models - Fatal编程技术网

Python 默认值';使用';模型中

Python 默认值';使用';模型中,python,django,django-models,Python,Django,Django Models,如何在模型中将“使用”设置为默认值?因此,我们不会总是在视图上调用它 list = OtherModel.objects.using("hede").all() 我试过了。但不起作用:( 有什么建议吗?您需要使用来实现这一点。请查看的文档 class OtherModel(models.Model): using = 'hede'

如何在模型中将“使用”设置为默认值?因此,我们不会总是在视图上调用它

list = OtherModel.objects.using("hede").all()
我试过了。但不起作用:(

有什么建议吗?

您需要使用来实现这一点。请查看的文档

class OtherModel(models.Model):
    using = 'hede'