Python 与django auth_用户一起使用django mptt
我正在尝试使用Python 与django auth_用户一起使用django mptt,python,django,django-models,django-mptt,Python,Django,Django Models,Django Mptt,我正在尝试使用django-mptt创建一个用户树。我有auth\u user表和一对一映射表UserProperties,它的外键为auth\u user。 我在用户表的UserPropertiesmodel(parent列)中添加了django mptt的treeforeingkey。但在创建对象时失败,出现以下错误: 'User' object has no attribute 'is_root_node' 方法(非属性)“is_root_node()”对查询项有效 item = Cla
django-mptt
创建一个用户树。我有auth\u user
表和一对一映射表UserProperties
,它的外键为auth\u user
。
我在用户表的UserProperties
model(parent
列)中添加了django mptt的treeforeingkey
。但在创建对象时失败,出现以下错误:
'User' object has no attribute 'is_root_node'
方法(非属性)“is_root_node()”对查询项有效
item = Class.objects.get()
或在迭代器或列表表达式中:
[item.is_root_node() for item in Class.objects.filter(name = 'name')]
但是,为了正确地回答您的问题,请您提供您的模型和查询的代码。您是否使用允许自定义用户模型的最新django?这将允许您组合用户和用户属性,并可能解决您的问题。我正在使用django-1.4.10,它支持自定义用户模型。我正在考虑1.5中引入的一个模型,请参阅