title: tracking user login with django
body: <p>I am using the builtin login module to perform logins in my website</p>
  
  <p><code>url(r'^login/$', 'django.contrib.auth.views.login', {'extra_context': {'page_name': 'login'}),</code></p>
  
  <p>and this is the next action of my login form</p>
  
  <p><code>&lt;input type="hidden" name="next" value="/redirect/"&gt;</code></p>
  
  <p>During registration I create a small tracking code for the user like this:</p>
  
  <pre><code>host = request.META.get('HTTP_X_FORWARDED_FOR','') or request.META.get('REMOTE_ADDR')
  if tid == '0':
      import os, binascii
      tid = binascii.hexlify(os.urandom(6))
  ut = UserTracking.objects.create(user=user, username=username, tracking_id=tid, remote_host=host, action='register')
  ut.save()
  variables = RequestContext(request, {'username': form.cleaned_data['username'], 'email': form.cleaned_data['email'], 'message': message, 'tid': tid})
  return render_to_response('registration/register_success.html', variables)
  </code></pre>
  
  <p>In the <code>register_success.html</code> I use a jquery plugin to save my tracking code into the user's pc like this:</p>
  
  <p><code>$.jStorage.set('tid', '{{ tid }}');</code></p>
  
  <p>How can I add this code to my login form and send in with username and password to my <code>views.py</code>? </p>