UPDATE:
If you want to process some data from one view in another view, you can do something like below:
def process_view(request, username):
''' This is the view where you want to process the username '''
# process the username ...
return something
def login_view(request):
''' Main login form through which data is submitted '''
if request.method == 'POST':
username = request.POST['username'] # the username submitted via form
# do something ...
# call the process_view below
return process_view(request, username)
If, however, you want to login the user, you would need to set an authentication cookie on that user's browser. Setting cookies will also allow you to process the username in any view you want.
Here's how you can set cookies:
def login_view(request):
if request.method == 'POST':
username = request.POST['username']
# set the cookie below
request.session['username'] = username
return something
And now, if you want to access the username in any other view, do this:
def some_view(request):
username = request.session['username']
# do something ...
return something
I suggest you go with the second approach i.e. the setting cookies approach, since it is more effective than calling a view from another view.