captcha.py 414 B

1234567891011121314151617
  1. from rest_framework.decorators import api_view
  2. from rest_framework.response import Response
  3. from django.http import Http404
  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()