Open realsby opened 7 years ago
I have a api view. I want to show fields in docs. Do we need a decorator to show fields in docs?
@api_view(['POST']) @permission_classes((AllowAny, )) @throttle_classes([AnonRateThrottle]) @api.doc(fields={'email': 'CharField', 'password':'CharField'}) def change_password(request): signed_email = request.data.get('email', '') password = request.data.get('password', '') try: email = loads(urlunquote(signed_email)) except BadSignature: return Response(status=status.HTTP_400_BAD_REQUEST) if len(password) < 6: return Response(status=status.HTTP_400_BAD_REQUEST) if not User.objects.filter(username=email): return Response(status=status.HTTP_404_NOT_FOUND) user = User.objects.get(username=email) user.set_password(password) user.save() return Response(status=status.HTTP_200_OK)
I have a api view. I want to show fields in docs. Do we need a decorator to show fields in docs?