sepme
sepme

Reputation: 51

How to handle 'dict' object has no attribute 'META'?

I'm trying to create a JSON response in a django project; but something goes wrong!

applications_list = []
for project in projects_list:
    application_information = {
        ``` some keys and values ```
    }
    applications_list.append(application_information)
context = {'applications': applications_list}

return render(request, self.template_name, context)

But I got this error:

'dict' object has no attribute 'META'

Should be mentioned that keys and values of application_information are serialized. I also tried json.dumps() but didn't work. I wonder what have been missed?

Upvotes: 1

Views: 772

Answers (1)

svorcan
svorcan

Reputation: 340

Sounds like you accidentally modified the request variable before you passed it to render call.

Check what happens with that variable in the code before the snippet you posted, or expand your question with additional code lines.

Upvotes: 1

Related Questions