Django inline formsets and choicefields generate too many db queries

前端 未结 2 1646
独厮守ぢ
独厮守ぢ 2021-02-09 12:28

I have a model with a number of foreign key fields, e.g. model Product with fields \'type\', \'level\', \'color\', \'intensity\' (just a generic example).

I then have a

2条回答
  •  礼貌的吻别
    2021-02-09 12:54

    field_queryset = Test.objects.all()    
    for form in formset:
            form.fields['test_field'].queryset = field_queryset
    

    Like this.

提交回复
热议问题