0
djangoテンプレート内の1つの入力テキストボックスにmanytomanyフィールドの値を表示したいとします。 私の出力は、私はABC、ABC、BVCdjangoテンプレート内の複数のフィールド値を1つのテキストボックスに表示する方法
ように私のコードサンプルは、私は、出力を表示するこの
<div class='col-sm-8'>
{% for car in cars %}<br/>
<input type='text' class='form-control' name='cars' placeholder='Select cars' value= {{car}}>
{% endfor %}
</div>
ありたい ABC/N Abcの/ N BVC/N
です
それはエラー '「ManyRelatedManager」オブジェクト私を示しビューのiterable'されていないその車を覚えて – vikrant
ファイルはクエリセット、そう...それを行うことになります。 .. cars = YourModelCar.ManyToManyRelation.all() 'を繰り返します。 –