django-quill-editor icon indicating copy to clipboard operation
django-quill-editor copied to clipboard

'str' object has no attribute '_committed'

Open parthjpandya opened this issue 4 years ago • 6 comments

Hi, I am getting below error while using a quill editor with Django.

if quill and not quill._committed: 'str' object has no attribute '_committed'

Is there any specific Django version to use or is there any other hack?

I am using Django==2.1.7 python 3.7.5 django-quill-editor==0.1.12

parthjpandya avatar Jul 03 '20 09:07 parthjpandya

I'm also experiencing this issue. It occurs when I call form.save() after a POST request in my view. No idea what to do with this.

Kirkmania avatar Aug 29 '20 01:08 Kirkmania

Were you able to resolve this issue? @parthjpandya @Kirkmania

raybesiga avatar Oct 09 '20 12:10 raybesiga

I'm facing the same issue using django-admin version 3.1.3, and Python 3.5.3

erwingd avatar Nov 09 '20 09:11 erwingd

Hi @parthjpandya @Kirkmania @erwingd

I figured out an easy way to get around the issue. Let us say you have a model called Updatewith one field called message, your ModelForm should look like this:

class CreateUpdateForm(forms.ModelForm):
    message = QuillFormField()
    class Meta:
        model = Update
        fields = ['message']

Hope this helps.

raybesiga avatar Nov 10 '20 19:11 raybesiga

Hi raybesiga,

Thanks for your answer, but I'm facing this issue in django admin, unfortunately this didn't help...

Thanks a lot for your help,

Erwin.

erwingd avatar Nov 11 '20 08:11 erwingd

Overriding/updating prepare_value method of the field may solve this issue.

class QuillFormField(forms.fields.JSONField):
    ...
    def prepare_value(self, value):
        return value.json_string
class QuillFormField(forms.fields.JSONField):
    ...
    def prepare_value(self, value):
        if hasattr(value, "json_string"):
            return value.json_string

This PR may fix this.

gokselcoban avatar Feb 10 '21 17:02 gokselcoban