Incorrect padding

Hello, I am a Django beginner.
I am trying to understand template engine.
one of my HTML template is like this:

<p>hello works</p>
{{ request.user.is_authenticated }} 

the error showing in the browser:

Error at /

Incorrect padding

Request Method: GET
Request URL:
Django Version: 2.0.7
Exception Type: Error
Exception Value: Incorrect padding
Exception Location: /home/dip05/anaconda3/lib/python3.7/ in b64decode, line 87
Python Executable: /home/dip05/anaconda3/bin/python
Python Version: 3.7.3
Python Path: [’/home/dip05/new_try’, ‘/home/dip05/anaconda3/lib/’, ‘/home/dip05/anaconda3/lib/python3.7’, ‘/home/dip05/anaconda3/lib/python3.7/lib-dynload’, ‘/home/dip05/.local/lib/python3.7/site-packages’, ‘/home/dip05/anaconda3/lib/python3.7/site-packages’]

if I remove this line:
{{ request.user.is_authenticated }}
it works.

can anyone explain what’s going on?

Hi @dipcb05, is there more to the error page? I’m specifically interested in the stack trace. That could tell us what is trying to be base 64 decoded (via b64decode)

I can’t recreate this behavior using any supported version of Django. My first suggestion would be to at least move your code to Django 2.2, and preferably to Django 3.2.

If that doesn’t help, then we may need to see the complete template, view, and User model if you’re using a custom User model