code: def form_invalid(self, form):
          
          if self.request.is_ajax():
              return self.render_json_response(self.get_error_result(form))
          return super(AjaxFormMixin, self).form_invalid(form)
docs: We have errors in the form. If ajax, return them as json.
          Otherwise, proceed as normal.