1👍
✅
You can use a variable in request.POST.get() instead of a string, for example.
request.POST.get(my_var)
However in your case, request.POST.get(field.unique_id)
does not work, since the keys in request.POST
are strings, and field.unique_id
is an integer.
The answer is to use str()
to convert it to a string.
request.POST.get(str(field.unique_id))
Source:stackexchange.com