Подскажите, пожалуйста, из-за чего возникает ошибка, при том в консоли ошибки нет.
MultiValueDictKeyError at /articles/check-age
'age'
Request Method: GET
Request URL: http://5785ef74-0bbc-4c61-a97b-b6f41e36225e.serverhub.praktikum-services.ru/articles/check-age
Django Version: 2.2.5
Exception Type: MultiValueDictKeyError
Exception Value:
'age'
Exception Location: /usr/local/lib/python3.7/site-packages/django/utils/datastructures.py in __getitem__, line 80
Python Executable: /usr/local/bin/python
Python Version: 3.7.4
Python Path:
['/app',
'/usr/local/lib/python37.zip',
'/usr/local/lib/python3.7',
'/usr/local/lib/python3.7/lib-dynload',
'/usr/local/lib/python3.7/site-packages']
Server time: Mon, 8 Jun 2020 05:34:33 +0000
def check_age(request):
if request.method == 'GET':
user_age = int(request.GET['age'])
if user_age < 18:
return render(request, 'templates/articles/access_denied.html')
else:
login = request.GET['login']
tag = request.GET['tag']
articles = get_articles_by_tag(tag)
context = {
'username' : 'login',
'age' : 'user_age',
'articles' : 'articles'
}
return render(request, 'templates/articles/access_granted.html', context)