def post(self, request, *args, **kwargs):
        """
        Builds a dynamic form that targets only the field in question, and saves the modification.
        """
        self.object_list = None
        form = self.get_xeditable_form(self.get_xeditable_form_class())
        if form.is_valid():
            obj = self.get_update_object(form)
            if obj is None:
                data = json.dumps({
                    'status': 'error',
                    'message': "Object does not exist."
                })
                return HttpResponse(data, content_type="application/json", status=404)
            return self.update_object(form, obj)
        else:
            data = json.dumps({
                'status': 'error',
                'message': "Invalid request",
                'form_errors': form.errors,
            })
            return HttpResponse(data, content_type="application/json", status=400)
def post ( self , request , * args , ** kwargs ) : self . object_list = None form = self . get_xeditable_form ( self . get_xeditable_form_class ( ) ) if form . is_valid ( ) : obj = self . get_update_object ( form ) if obj is None : data = json . dumps ( { 'status' : 'error' , 'message' : "Object does not exist." } ) return HttpResponse ( data , content_type = "application/json" , status = 404 ) return self . update_object ( form , obj ) else : data = json . dumps ( { 'status' : 'error' , 'message' : "Invalid request" , 'form_errors' : form . errors , } ) return HttpResponse ( data , content_type = "application/json" , status = 400 )
Builds a dynamic form that targets only the field in question, and saves the modification.