TYPE ERROR at /login/: ; Help me Resolve

54 views
Skip to first unread message

Madhav Nandan

unread,
May 23, 2020, 3:06:08 AM5/23/20
to django...@googlegroups.com
Hello all,

I was making an eCommerce web application using Django 2.X.

I'm getting TYPE ERROR at /login/: 
here screenshots are attached, help me resolve issues:

I did make all the required changes, however, I don't find how to get rid of this.

for all docs, please follow this link: 




--
Madhav Nandan
Screenshot 2020-05-22 at 3.05.03 PM.png
Screenshot 2020-05-22 at 3.08.12 PM.png
Screenshot 2020-05-22 at 3.05.55 PM.png
Screenshot 2020-05-21 at 8.43.35 PM.png

LGBS fine soul coders

unread,
May 23, 2020, 3:15:23 AM5/23/20
to django...@googlegroups.com
Py manage. py makemigrations 


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGXYL6K7Xd_TOabAy%2BiO%3DX%2B2NFbWUH2N9AZCVxaePrD%3D1cnLPg%40mail.gmail.com.

Kasper Laudrup

unread,
May 23, 2020, 3:35:24 AM5/23/20
to django...@googlegroups.com
Hi Madhav,

On 23/05/2020 09.03, Madhav Nandan wrote:
> Hello all,
>
> I was making an eCommerce web application using Django 2.X.
>
> I'm getting TYPE ERROR at /login/:
> here screenshots are attached, help me resolve issues:
>
> I did make all the required changes, however, I don't find how to get
> rid of this.
>

Try to look at the actual error message. It is quite helpful and this is
really simple. It is pointing at line 39 of your views.py where you have:

print(request.user.is_authenticated())

And telling you that a 'bool' object is not callable.

A callable object is something like a function and it does indeed look
like you are calling is_authenticated as a function. Try this:

foo = True
foo()

TypeError: 'bool' object is not callable

Looks familiar right?

So you cannot "call" a bool object which is what you are trying to do.
So maybe you should call it but simply test its value instead like you
would normally do for bool objects?

Kind regards,

Kasper Laudrup

Ousseynou Diop

unread,
May 23, 2020, 7:59:01 AM5/23/20
to Django users
Hello Guys, the problem is that you call the authenticated method, don't do this.
Remove the parenthesis, print(request.user.is_autheticated)

Anubhav Madhav

unread,
May 23, 2020, 10:43:31 AM5/23/20
to Django users
Exactly, django now supports is_authenticated as an attribute and not as a method is_authenticated().

Try is_authenticated.

Madhav Nandan

unread,
May 23, 2020, 10:51:39 PM5/23/20
to django...@googlegroups.com
Thanks guys.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/351066d9-4eda-4a1c-9ed7-c78fa8689c9b%40googlegroups.com.


--
Madhav Nandan
Reply all
Reply to author
Forward
0 new messages