title: Getting Django Rest Framework to get postdata from specific post variable
body: <p>I am building a Django application with a Vue.js 2 SPA. This means that everything has to be done using AJAX calls. In my case, these are handled with axios.</p>
  
  <p>To make things easier, I have found a Form class for ES6 online. This allows me to have a reusable form object that I can easily submit and still handle the <code>Promise</code> like if I was doing it directly with axios.
  The form class looks like this:</p>
  
  <pre><code>import Errors from './Errors';
  export default class Form {
      /**
       * Create a new Form instance.
       *
       * @param {object} data
       */
      constructor(data) {
          this.originalData = data;
  
          for (let field in data) {
              this[field] = data[field];
          }
  
          this.errors = new Errors();
      }
  
  
      /**
       * Fetch all relevant data for the form.
       */
      data() {
          let data = {};
  
          for (let property in this.originalData) {
              data[property] = this[property];
          }
  
          return {data};
      }
  
  
      /**
       * Reset the form fields.
       */
      reset() {
          for (let field in this.originalData) {
              this[field] = '';
          }
  
          this.errors.clear();
      }
  
  
      /**
       * Send a POST request to the given URL.
       * .
       * @param {string} url
       */
      post(url) {
          return this.submit('post', url);
      }
  
  
      /**
       * Send a PUT request to the given URL.
       * .
       * @param {string} url
       */
      put(url) {
          return this.submit('put', url);
      }
  
  
      /**
       * Send a PATCH request to the given URL.
       * .
       * @param {string} url
       */
      patch(url) {
          return this.submit('patch', url);
      }
  
  
      /**
       * Send a DELETE request to the given URL.
       * .
       * @param {string} url
       */
      delete(url) {
          return this.submit('delete', url);
      }
  
  
      /**
       * Submit the form.
       *
       * @param {string} requestType
       * @param {string} url
       */
      submit(requestType, url) {
          return new Promise((resolve, reject) =&gt; {
              axios[requestType](url, this.data())
                  .then(response =&gt; {
                      this.onSuccess(response.data);
  
                      resolve(response.data);
                  })
                  .catch(error =&gt; {
                      this.onFail(error.response.data);
  
                      reject(error.response.data);
                  });
          });
      }
  
  
      /**
       * Handle a successful form submission.
       *
       * @param {object} data
       */
      onSuccess(data) {
          console.log(data);
          this.reset();
      }
  
  
      /**
       * Handle a failed form submission.
       *
       * @param {object} errors
       */
      onFail(errors) {
          this.errors.record(errors);
      }
  }
  </code></pre>
  
  <p>The part that is currently giving me some issues is that, when I submit the data to Django REST Framework, I get all the handling of the code by using the ModelSerializer, but I cannot seem to find an easy way to tell it that the <code>POST</code> data is structured a little different from what it is expecting.
  This is a sample request data:</p>
  
  <pre><code>{"data":{"name":"b-0123","windfarm":2,"longtitude":"234","latitude":"345","ip_address":"10.0.0.123"}}
  </code></pre>
  
  <p>I know that the solution is either to let Django know that it should get the <code>POST</code> data for the model, from <code>request.POST['data']</code> or to get the ES6 Form class to pass the raw fields instead of sending everything as a data object.
  The part I do not know is how to get either of these to work.</p>