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

在使用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必须是多对多,没有多对多的关系 就会报错

 

转载于:https://www.cnblogs.com/xuchunlin/p/6306064.html

你可能感兴趣的:(The value of 'filter_horizontal[0]' must be a many-to-many field. The value of 'raw_id_fields[0]' mu...)