12311k

Untitled

Jan 31st, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. from django.http import HttpResponse
  2. from django.shortcuts import render
  3. from . import anfisa
  4.  
  5.  
  6. def about(request):
  7. return render(request, 'templates/about.html')
  8.  
  9.  
  10. def index(request):
  11. html = ''
  12. if request.method == 'POST':
  13. query = request.POST['query']
  14. answer = anfisa.process_query(query)
  15. html = f'<mark>{answer}</mark>'
  16. context = {
  17. 'response': html,
  18. 'where': request.path
  19. }
  20. return render(request, 'templates/index.html', context)
Add Comment
Please, Sign In to add comment