django-positions - 使用parent_link的多表模型继承

Jac*_*ack 5 python django

使用https://github.com/jpwatts/django-positions,

我有一些继承父母的模型,例如:

class ContentItem(models.Model):

    class Meta:
        ordering = ['position']

    content_group = models.ForeignKey(ContentGroup)
    position      = PositionField(collection='content_group', parent_link='contentitem_ptr')

class Text(ContentItem):

    title = models.CharField(max_length=500, unique=False, null=True, blank=True)
Run Code Online (Sandbox Code Playgroud)

我知道我需要使用parent_link参数(这里是文档).但是当我使用它时出现这个错误:

websites.Text: (models.E015) 'ordering' refers to the non-existent field 'position'.
Run Code Online (Sandbox Code Playgroud)

使用parent_link参数时,就好像该position字段已完全从模型中删除.我尝试了各种字段名称,例如contentitem_ptr_id(链接字段的实际名称),但没有运气.任何可识别的东西我在这里做错了吗?

小智 -1

class Meta:应该位于您的字段定义之后。