Django, set initial data to formset with ManyToMany

前端 未结 3 663
-上瘾入骨i
-上瘾入骨i 2021-02-10 21:04

I need to set initial data to formset with ManyToMany field.

Usually i\'m doing like this when there is no ManyToMany field in forms o

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-10 21:06

    You should provide a list of pk as initial data for your ManyToMany relation instead of a dict.

    Take a look at this thread, it might helps you.

提交回复
热议问题