title: @login_required not working as expected in Django?
body: <p>I find <code>@login_required</code> very useful. I have used this <code>@login_required(login_url='/login/')</code> before each views. If the user tries to access <code>/upload</code> url it redirects to url as: <code>http://127.0.0.1:8000/login/?next=/upload_file/</code> My urls are very simple:</p>
  
  <pre><code>urlpatterns = patterns('',
  
      #url(r'^admin/', include(admin.site.urls)),
      url(r'^upload_file/', 'fileupload.views.upload_file'),
      url(r'^show_file/', 'fileupload.views.show_list'),
      url(r'^sync/', 'fileupload.views.sync'),
      url(r'^login/', 'fileupload.views.login_user'),
      url(r'^upload_file_form', 'fileupload.views.upload_file_form' )
  )
  </code></pre>
  
  <p>Now when the user presses login the page is redirected to nowhere. I am sure my url pattern is not correct. What am I missing? Thanks</p>
  
  <p><strong>Edit</strong>:</p>
  
  <pre><code>def login_user(request):
      errors = []
      state = "LOG IN"
      username = password = ''
      if request.method == 'POST':
          username = request.POST['username']
          password = request.POST['password']
          user = authenticate(username='username', password='password')
          if user is not None:
              if user.is_active:
                  login(request, user)
                  state = "You're successfully logged in!"
              else:
                  state = "Your account is not active, please contact the site admin."
          else:
              state = "Your username and/or password were incorrect."
  
      return render_to_response('login.html', {'state':state, 'username': username}, context_instance=RequestContext(request))
  </code></pre>