captcha.py 388 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 not request.settings.qa_question:
  7. raise Http404()
  8. return Response(
  9. {
  10. "question": request.settings.qa_question,
  11. "help_text": request.settings.qa_help_text,
  12. }
  13. )