I have a function in views.py
def login(request):
actor = LoginActor(request)
actor.authenticated_user() # Cannot use return here, this is problematic, we need to redirect here without using a return statement
ctx = actor.get()
if request.method == 'POST':
ctx = actor.post()
return render(request, 'user/forms/auth.jinja', ctx)
return render(request, 'user/login.jinja', ctx)
and there is a redirect in authenticated_user() function which is defined as:
def authenticated_user(self):
if self.request.user and self.request.user.is_authenticated:
return redirect('home')
How do i return from the initial view without calling a return, basically i want to return the callee function where there is a return in called function
I am using Django 2.1 with Python 3.7