вот ошибка
MultiValueDictKeyError at /publish
'secret'
Request Method: POST
Request URL:
127.0.0.1:8000/publish
Django Version: 3.0.5
Exception Type: MultiValueDictKeyError
Exception Value:
'secret'
Exception Location: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/utils/datastructures.py in __getitem__, line 78
Python Executable: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
Python Version: 3.8.2
Python Path:
['/Users/denislysenko/Downloads/coda/mysite1',
'/Library/Frameworks/Python.framework/Versions/3.8/lib/python38.zip',
'/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8',
'/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages']
Server time: Tue, 28 Apr 2020 16:10:50 +0000
вот views.py
def publish(request):
if request.method == 'GET':
return render(request, 'publish.html')
else:
secret = print(request.POST['secret'])
name = print(request.POST['name'])
text = print(request.POST['text'])
publications_date.append({
'id': len(publications_date),
"name": name,
"date": datetime.now(),
"text": text
})
return redirect('/publications')