开发者

django-mptt ImportError

开发者 https://www.devze.com 2023-02-28 09:23 出处:网络
I have installed django-mptt and have followed the documentation regarding setting up a Django model for MPTT

I have installed django-mptt and have followed the documentation regarding setting up a Django model for MPTT

However, I am getting the following ImportError:

 from mptt.models import MPTTModel, TreeForeignKey
 ImportError: cannot import name Tree开发者_开发知识库ForeignKey

Can anyone help?

Any advice appreciated.

Thanks.


TreeForeignKey is a class defined in the file fields.py. It looks like this file was just recently added to the code base for v0.5.pre.

If you are using version 0.4.2 or older, this file and class don't exist. I'm not sure how this package is intended to be used without this class, since the documentation only applies to the latest version of the code (v0.5.pre).

Good Luck!

0

精彩评论

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