title: Unable to access a variable from one view to another view using functions?
body: <p>I have written a Registration form in Django. I'm trying to pass the name of the user getting registered successfully from the view1 (register_user) to view2 (register_success). So that the user can see his name on the registration successful page.
  Below are the 2 views</p>
  
  <p>View1</p>
  
  <pre><code>def register_user(request):
      if request.method == 'POST':
          form = UserCreationForm(request.POST)
          if form.is_valid():
              form.save()
  #Function for retrieving username from the form
              def give_username():
                  return form.cleaned_data.get["username"]
              return HttpResponseRedirect('/accounts/register_success')
  
          else:
               form = UserCreationForm()
      args = {}
      args.update(csrf(request))
      args['form'] = UserCreationForm()
      return render(request,'register.html',args)
  </code></pre>
  
  <p>View2</p>
  
  <pre><code>def register_success(request):
      full_name = register_user(request).give_username
      return render (request,'register_success.html',{'full_name':full_name})
  </code></pre>
  
  <p>register_success.html</p>
  
  <pre><code>{% extends "base.html" %}
  {% block content %}
             &lt;h2&gt;Hey {{ full_name }}, Greetings .. You have registered successfully !&lt;/h2&gt;
             &lt;p&gt;Click &lt;a href="/accounts/login/"&gt;here&lt;/a&gt; to login again&lt;/p&gt;
  {% endblock %}
  </code></pre>
  
  <p>I am not using the sessions to store the variable as it can be a bad practice.
  So when trying the above code, I get this error.</p>
  
  <pre><code>AttributeError at /accounts/register_success/
  'HttpResponse' object has no attribute 'give_username'
  Request Method:     GET
  Request URL:    http://127.0.0.1:8000/accounts/register_success/
  Django Version:     1.9.2
  Exception Type:     AttributeError
  Exception Value: 
  
  'HttpResponse' object has no attribute 'give_username'
  Exception Location:     /home/harish/django/django/django_test/django_test/views.py in register_success, line 56
  Python Executable:  /home/harish/django/django/bin/python
  Python Version:     2.7.6
  Python Path:    
  
  ['/home/harish/django/django/django_test',
   '/home/harish/django/django/local/lib/python2.7/site-packages/Django-1.9.2-py2.7.egg',
   '/home/harish/django/django/lib/python2.7/site-packages/Django-1.9.2-py2.7.egg',
    '/home/harish/django/django/lib/python2.7']
  Server time:    Thu, 4 Feb 2016 05:44:16 +0000
  </code></pre>
  
  <p>Where am I going wrong in accessing the username variable ?</p>