I'm a newbie in django and I'm having some problems, what I'm trying to do is a simple login system in Django with a custom backend and using postgresql as the main db.
The problem is, my authentication and login function is apparently working normally but the user is not actually logged in, I wrote a custom message to let me know when the user is logged in and my index is protected against anonymous user, so I basically can't access.
This code from my views.py
@login_required(login_url='signin')
def index(request):
    return render(request, 'index.html')
def signin(request):
    now = datetime.now()
    if request.method == 'POST':
        username = request.POST['username']
        password = request.POST['password']
        print(username, password)
        user = UserBackend.authenticate(UserBackend(), username=username, password=password)
        if user is not None:
            login(request, user, backend='core.backends.UserBackend')
            print('Logged In') #### This print/checking is working fine!
            return redirect('/')  
            #return render(request, 'index.html')
        else:
            messages.info(request, 'Invalid Username or Password! Try again')
            return redirect("signin")
    #else:
        return render(request,'signin.html')
    
    #user = auth.authenticate(username=username, password=password)
    return render(request, 'signin.html')
This is my user class from models.py
class user(AbstractBaseUser):
    id = models.AutoField(primary_key=True)
    username = models.TextField()
    real_name = models.TextField()
    email = models.TextField()
    password = models.TextField()
    description = models.TextField()
    last_login = models.DateField()
    created_at = models.DateField()
    is_staff = models.BooleanField(default=False)
    is_active = models.BooleanField(default=True)
    class Meta:
        managed = False
        db_table = 'user'
        
   
    def __str__(self) -> str:
        return self.username
And my user backend from backends.py
class UserBackend(ModelBackend):
    def authenticate(self, **kwargs):
        username = kwargs['username']
        password = kwargs['password']
        print('user: ', username)
        print('pass: ', password)
        #try:
        user_ = user.objects.get(username=username)
        
        try:
            print(user_.check_password(password))
            if user_.check_password(password) is True:
                return user_
        except user.DoesNotExist:
            pass
        def get_user(self, user_id):
            try:
                return user.objects.get(pk=user_id)
            except user.DoesNotExist:
                return None
I tried changing the return on views.py to something like
 return redirect(request.GET.get('next')) 
but still not working :(
what should I do?