Generally this error occurs when we retrieve data from a model using get() method and try to access data as dictionary keys. get() method is used when we know that there is only record matching the condition and we want to retrieve a single object.
userDetails = Users.objects.get(pk=123)
If you try to access data as userDetails[‘fieldName’], it will give an error: “Users object is not subscriptable“
You can access data from object returned from get() method like
For example: userId = userDetails.id
userName = userDetails.name