我还使用令牌对其进行了身份验证,但是当我创建一个新的post错误是alert IntegrityError at /api/create/ NOT NULL constraint failed: core_article.author_idmodel.py from django.contrib.auth.models import User
retur
默认情况下,DRF返回数组中的对象,我只想要一个自定义的对象。class PostDetailApiView(ListAPIView, CreateAPIView): permission_classes**django.template.response.ContentNotRenderedError: The response content must be rendered before it can03/May/
假设此字段可以为空。Entry.objects.filter(author=X)
其中X是某个值。假设我在SQL中为其他列和author_id的条目设置了一个复合索引,理想情况下,我希望MySQL只在条目模型上使用"author_id“,这样它就可以使用复合索引。但是,如果我说author=None,Django与Author进行连接,然后添加到Where子句Author.id IS NULL。所以在这种情况下,它不能使用复合索引。有没有办法告诉Dja