Exception Value: | latest_posts() missing 1 required positional argument: 'cls' |
---|
#blog/views.py的代码:
post_list = Post.latest_posts() #这里需要一个参数是什么?
#blog/models.py的代码:
@classmethod
def latest_posts(cls):
queryset = cls.objects.filter(status=cls.STATUS_NORMAL)
return queryst
相似问题