I\'m trying to save a object to my database, but it\'s throwing a MultiValueDictKeyError
error.
The problems lies within the form, the is_private<
Choose what is best for you:
is_private = request.POST.get('is_private', False);
If is_private
key is present in request.POST the is_private
variable will be equal to it, if not, then it will be equal to False.
if 'is_private' in request.POST:
is_private = request.POST['is_private']
else:
is_private = False
from django.utils.datastructures import MultiValueDictKeyError
try:
is_private = request.POST['is_private']
except MultiValueDictKeyError:
is_private = False