'Django 'WSGIRequest' object is not callable
I'm working on an app and I'm trying to display all my users but I get this error
TypeError at /everyone/
'WSGIRequest' object is not callable
File "/home/snake/mysite/pet/views.py" in Everyone
14. return HttpResponseRedirect(request('world:Profile'))
Exception Type: TypeError at /everyone/
Exception Value: 'WSGIRequest' object is not callable
I did a lookup at my shell prompt and it successfully work but when I implement as a function into my views.py why do I get this error.
everyone = Person.objects.all() print everyone < sam > < amy >
My views.py
def Everyone(request):
if request.user.is_authenticated():
return HttpResponseRedirect(request('world:Profile'))
everyone =Person.objects.all()
return render(request,'everyone.html',{'everyone':everyone})
My models.py
class Person(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=100)
image = models.FileField(upload_to="images/",blank=True,null=True)
My everyone.html
{% for one in everyone %}
{{one.name}}
{{one.user.username}}
{% endfor %]
Solution 1:[1]
return HttpResponseRedirect(request,'world:Profile')
Test remove braces around the 'world:Profile'.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
