我在加载过程中得到FATAL: database "xxxxxxxxx" does not exist
py.测试. 这来自于管理表单的加载,其中我将一个queryset传递给ModelChoiceField
class CustomChoiceField(forms.ModelChoiceField):
def __init__(self, queryset=None, *args, **kwargs):
return super().__init__(SomeModel.objects.limited_qs(), *args, **kwargs)
class SomeModelForm(forms.ModelForm):
some_model = CustomChoiceField()
class Meta:
model = SomeModel
class SomeModelAdmin(admin.ModelAdmin):
form = SomeModelForm
我试过了
^{pr2}$所有的结果都与py.测试在
编辑
在__init__
方法或formfield_overrides
中使用queryset也会破坏迁移。在
注意:这些都是我希望它们在服务器上的工作方式-它们只是阻止我运行任何测试。在
我如何让它通过(不需要有条件地注册我的管理资料;\uI like tdd)
我也有类似的问题,在我的情况下,问题是模型对象有限公司(),我给另一个queryset打了个电话:
因此,为了构建查询集,在创建测试数据库之前执行了对数据库的调用,导致“致命数据库不存在”
相关问题 更多 >
编程相关推荐