2๐
โ
Use a different variable name
project_request = ProjectRequest.objects
The issue is because of this context_instance = RequestContext(request)
It loses context of the request
object as it has been overwritten. Hence the issue.
def myRequests(request):
project_request = ProjectRequest.objects
#Now you have access to request object,
# do whatever you want with project_request -
response = render_to_response('myRequests.html', {'ProjectRequest': project_request}, context_instance = RequestContext(request))
return response
The reason you are getting the error 'Manager' object has no attribute 'META'
is, when you do
ProjectRequest.objects
the default manager (objects
) for models ProjectRequest
is assign to the (overwritten) local variable request
.
๐คkarthikr
Source:stackexchange.com