-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raises QuillParseError(json_string) when using api for model with quill #13
Comments
What is the API sending?
The data object of Quill.js, Delta, and the expression html code are combined and transmitted. How to send the contents of Quill.js to the API in a separate front end is not yet considered. Are you using DRF? |
Yes I am using DRF. QuillParseError at /api/blog/create |
I haven't tested it yet, but if you use a form made with django-quill-editor, there is a way to do it. |
I am not using any WYSIWYG with the api. Just normal text input field. This means the data submitted will just be a normal string value. However, quillfield in app model, is expecting a json string. I will think, the best way to go is not to force every input to be a json_string?. Or how about, if exception(QuillParseError(json_string)) is caught, convert the content to Quill Json_string format? This class is where I think it should be worked on to handle the different cases..
|
Any solution to this? I am trying to create an object with a Quill field on POST to a DRF endpoint. POST data is in Quill's weird format which cannot be parsed in Django APIView. But if I try to create a Quill object in my APIView, I get the QuillParseError. There should be a way to populate a QuillField using a string. It is not clear to me if even the base QuillJS library provides a way to post JSON? |
@ericel @faaizajaz @LeeHanYeong def get_quill(value):
quill = Quill({
'html': '<p>%s</p>' % value,
'delta': {
"ops": [
{"insert": "%s\\n" % value}
]
}
})
return quill
obj.quill_field = get_quill("hello")
obj.save() |
if you have "django_quill.quill.QuillParseError:" error you can try this :
|
Resolving Django QuillParseError with Proper JSON Formatting. Facing an ongoing issue for the past four hours, I encountered a QuillParseError while attempting to save data from a Quill editor in a Django application. The error message indicated a failure in parsing the JSON data sent from the client-side to the server.
This JavaScript code ensures that the Quill editor's content is properly formatted into a JSON object before being submitted with the form. By stringifying the JSON data, I was able to resolve the QuillParseError and successfully save the data in the Django database |
The editor raises a QuillParseError, when posting from an api.
Understandable as api is sending a string not a quill json object.
What will be the way to implement this on django site to convert string to quill json object.
The text was updated successfully, but these errors were encountered: