开发者

Django OneToMany form on related model

I've created a onetomany relationship between two models. The model that has the foreignkey I can use their formset without problems, but now I want to fill th开发者_JAVA百科is relation through the form of the model that has the "many", I know I can retrieve it using the *_set, but how can I create a MultipleChoiceField form element of this data?

Thanks for any help!

Regards,

Thiago


Have a look at the docs for fields which handle relationships. You could use a ModelMultipleChoiceField -- it's essentially a MultipleChoiceField that takes its choices from a queryset.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜