captcha.py 413 B

12345678910111213141516
  1. from django.http import Http404
  2. from rest_framework.decorators import api_view
  3. from rest_framework.response import Response
  4. @api_view()
  5. def question(request):
  6. if request.settings.qa_question:
  7. return Response(
  8. {
  9. "question": request.settings.qa_question,
  10. "help_text": request.settings.qa_help_text,
  11. }
  12. )
  13. else:
  14. raise Http404()