我有下面的表单,它应该返回Cashpool的查询集cashpool__name=request.user.company.cashpool。要执行正确的查询,它需要来自视图的信息。AddAccountForm(forms.Form):
company = forms.ModelChoiceField是否有任何方法将额外的参数传递给视图中的表单,以使用户对象在表
我需要多次渲染选择字段,并且每个字段都有预先选择的值。 现在我的问题是:如何在呈现django模板时动态设置django form selectfield的初始值?我的表单: class RequestProdApvr(forms.Form):
product = forms.ModelChoiceField(queryset=Product.objects.all().order_by('code