title: Angular http post not passing data to django view
body: <p>I am trying to pass the data using angular $http post to django view but it is not happening. Every time I pass the data it shows empty dict, that means I am not using POST request correctly. I am new in integration django and angular app, so it would be great if someone can help me out with this.</p>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>vm.login = function() {
              vm.authMsg = '';
              var login_data = {'username': vm.account.username, 'password': vm.account.password};
  
              if(vm.loginForm.$valid) {
  
                $http
                  .post('/login_app/', {login_data:JSON.stringify(login_data)})
                  .then(function(response) {
                     console.log(login_data);
  
                    if ( !response.login_data ) {
                      vm.authMsg = 'Incorrect credentials.';
                      // vm.authMsg = response;
                    }else{
                      $state.go('app.dashboard');
                    }
                  }, function() {
                    vm.authMsg = 'Server Request Error';
                  });
              }
              else {
                vm.loginForm.account_username.$dirty = true;
                vm.loginForm.account_password.$dirty = true;
              }
            };
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def login_app(request):
      if request.method == 'POST':
          print request.POST
          username = request.POST.get('username')
          password = request.POST.get('password')
  
          print 'username', username
          print 'password', password
          user = authenticate(username=username, password=password)
          print 'user', user
          if user:
              if user.is_authenticated():
                  print 'user authenticate'
                  login(request, user)
                  return HttpResponse(json.dumps({}), content_type='application/json')
          else:
              return HttpResponse('&lt;h1&gt;Access Denied.&lt;br&gt;Wrong Credentials.&lt;/h1&gt;')
  </code></pre>
  
  <p><strong>login.html</strong></p>
  
  <pre><code>&lt;form role="form" ng-submit="login.login()" name="login.loginForm" novalidate="" class="form-validate mb-lg" method="post"&gt;
  
              &lt;div class="form-group has-feedback"&gt;
                 &lt;input id="exampleInputUsername1" type="text" name="account_username" placeholder="Enter username" autocomplete="off" ng-model="login.account.username" required="" class="form-control" /&gt;
                 &lt;span class="fa fa-envelope form-control-feedback text-muted"&gt;&lt;/span&gt;
                 &lt;span ng-show="login.loginForm.account_username.$dirty &amp;amp;&amp;amp; login.loginForm.account_username.$error.required" class="text-danger"&gt;This field is required&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="form-group has-feedback"&gt;
                 &lt;input id="exampleInputPassword1" type="password" name="account_password" placeholder="Password" ng-model="login.account.password" required="" class="form-control" /&gt;
                 &lt;span class="fa fa-lock form-control-feedback text-muted"&gt;&lt;/span&gt;
                 &lt;span ng-show="login.loginForm.account_password.$dirty &amp;amp;&amp;amp; login.loginForm.account_password.$error.required" class="text-danger"&gt;This field is required&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="clearfix"&gt;
                 &lt;div class="checkbox c-checkbox pull-left mt0"&gt;
                    &lt;label&gt;
                       &lt;input type="checkbox" value="" name="account_remember" ng-model="login.account.remember" /&gt;
                       &lt;span class="fa fa-check"&gt;&lt;/span&gt;Remember Me&lt;/label&gt;
                 &lt;/div&gt;
                 &lt;div class="pull-right"&gt;&lt;a ui-sref="page.recover" class="text-muted"&gt;Forgot your password?&lt;/a&gt;
                 &lt;/div&gt;
              &lt;/div&gt;
              &lt;button type="submit" class="btn btn-block btn-primary mt-lg"&gt;Login&lt;/button&gt;
           &lt;/form&gt;
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.conf.urls import patterns, url
  from login import views
  
  urlpatterns = patterns('',
                      url(r'^$',views.home, name='home'),
                      url(r'^login_app/$',views.login_app, name='login_app'),
                      )
  </code></pre>