title: Post to URL running django and exempting CSRF
body: <p>I have a login page Mayan EDMS that's running on django. You would usually login by entering username and password and clicking on the login button. What I need to achieve instead is from my server side which is running on sailsjs to post this username and password. How can I do This?</p>
  
  <p>This is what I tried but received a 403 Forbidden message.</p>
  
  <pre><code>$.post({
   Url: "https://mayan/authentication/login/",
   Data:"username=admin&amp;password=mypass&amp;next=/",
   Success: function(data){
    Console.log(data);
   }
  });
  </code></pre>
  
  <p>As i understand it, a csrf token is required, so what i did was to disable the csrf token authentication using "csrf_excempt" in urls.py as suggested by this post: <a href="https://stackoverflow.com/questions/11610306/how-to-exempt-csrf-protection-on-direct-to-template">How to exempt CSRF Protection on direct_to_template</a></p>
  
  <p>I modified it to "url(r'^login/&amp;', csrf_exempt(login_view), name='login_view')", but when I tried posting the username and password I still get the 403 forbidden. So i am confused, is this correct? Am i only excepting csrf on the login view? Or do i need to somehow exempt the login function or something like that? I have zero knowledge on how python works and struggling to find out.</p>