【发布时间】:2011-11-28 20:12:34
【问题描述】:
Eclipse/pydev 中的代码完成对我来说很不错。但是,有一件事不能像我想要的那样工作。考虑以下 django 模型:
class ReletionTree(models.Model):
mother = models.ForeignKey('RelationTree', blank=True, null=True)
father = models.ForeignKey('RelationTree', blank=True, null=True)
name = models.CharField()
rt = RelationTree.objects.get(name='Mary') #assume unique on Mary
现在问题来了:
rt. #--> will code complete and give me options mother/father/name
rt.mother. #--> will not code complete into mother/father/name, it will code
# complete as if isinstance(rt.mother, models.ForeignKey) (I think)
有没有办法让 Pydev 明白我希望它编写完整的外键 好像它们指向的类型在哪里(在上面的情况下是 RelationTree 而不是 models.ForeignKey)
谢谢,大卫
【问题讨论】:
标签: python django eclipse autocomplete pydev