The value of 'filter_horizontal[0]' must be a many-to-many field. The value of 'raw_id_fields[0]' must be a foreign key or a many-to-many field.

在使用django admin的时候 我们遇到这个错误

<class 'Salesman.admin.UsrMngUserAdmin'>: (admin.E020) The value of 'filter_horizontal[0]' must be a many-to-many field.
The value of 'raw_id_fields[0]' must be a foreign key or a many-to-many field.
raw_id_fields = ('department',)  # department必须是多对多,没有多对多的关系 就会报错
filter_horizontal = ('department',)  # department必须是多对多,没有多对多的关系 就会报错

 

posted @ 2017-01-19 12:04  淋哥  阅读(647)  评论(0编辑  收藏  举报