Django错误,我该怎么办



shop.category:字段'parent_category'的反向查询名称与相关字段'category.category'冲突。将related_name参数添加到'parent_tegory'的定义中。

django 1.3.1版
python 2.7.2版本

是的,您需要在模型中的相应字段中添加一个related_name参数。看见https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.related_name

相关内容

最新更新