captcha.py 565 B

1234567891011121314151617181920212223
  1. from django.http import Http404
  2. from rest_framework.decorators import api_view
  3. from rest_framework.response import Response
  4. from misago.conf import settings
  5. @api_view(['GET', 'POST'])
  6. def question(request, question_id):
  7. try:
  8. question_id = int(question_id)
  9. except TypeError:
  10. raise Http404()
  11. if settings.qa_question and question_id == 1:
  12. return Response({
  13. 'id': question_id,
  14. 'question': settings.qa_question,
  15. 'help_text': settings.qa_help_text,
  16. })
  17. else:
  18. raise Http404()