【发布时间】:2016-02-06 09:55:29
【问题描述】:
我仅在使用方法装饰器的 POST 方法上使用基于类的视图和应用权限类。直到昨天它还在工作,但突然停止了。我找不到问题。
class OfferCreateListView(ListCreateAPIView):
serializer_class = OfferSerializer
queryset = Offers.objects.filter(user__isnull=True)
@method_decorator(permission_classes((IsAuthenticated,)))
@method_decorator(authentication_classes((BasicAuthentication, SessionAuthentication, TokenAuthentication,)))
def post(self, request, *args, **kwargs):
return super(OfferCreateListView, self).post(request, *args, **kwargs)
我在哪里做错了。有什么设置可以让它工作吗??
【问题讨论】:
-
“突然间停止了”不是很具有描述性...会发生什么?错误?结果无效?
-
@Sayse 不知道...但我可以在未经身份验证的情况下发帖..
标签: python django django-rest-framework decorator django-class-based-views