Skip to content
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

Integrate with Django Rest Framework #98

Open
Enzodtz opened this issue Oct 15, 2022 · 3 comments
Open

Integrate with Django Rest Framework #98

Enzodtz opened this issue Oct 15, 2022 · 3 comments

Comments

@Enzodtz
Copy link
Contributor

Enzodtz commented Oct 15, 2022

Hey!

I was trying to use the editor with DRF, but when DRF serializes the field, it just calls str method, which returns that default python str for classes. If we instead return the delta, it will be possible to integrate with the serializer just fine.

I will open a PR to do so.

Enzodtz added a commit to Enzodtz/django-quill-editor that referenced this issue Oct 15, 2022
Returning delta on str for integration with DRF. Issue: LeeHanYeong#98
@Enzodtz
Copy link
Contributor Author

Enzodtz commented Oct 15, 2022

PR Opened: #99

@scroogeT
Copy link

What's the status on this, I need to use the QuillField in my App via an API but there seems to be no easy way to achieve this out of the box.

@goodnewsj62
Copy link

goodnewsj62 commented Jan 28, 2023

@scroogeT i had to override the to_representation method of rest framework serializer class to get instance.content.delta like so.

def to_representation(self, instance):
        resp = super().to_representation(instance)
        resp["content"] = instance.content.delta
        return resp

content is the atrribute with quill field...

LeeHanYeong pushed a commit that referenced this issue Sep 20, 2024
Returning delta on str for integration with DRF. Issue: #98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants