springload / wagtaildraftail

🐦📝🍸 Draft.js editor for Wagtail, built upon Draftail and draftjs_exporter
https://pypi.python.org/pypi/wagtaildraftail
MIT License
24 stars 3 forks source link

Document the fact that the |richtext filter is redundant here #61

Closed gasman closed 6 years ago

gasman commented 6 years ago

It turns out that #18 didn't just eliminate the need for a custom |draft_text template filter - it makes the |richtext filter unnecessary as well. |richtext is only needed to convert plain strings of Wagtail-DB-HTML into real HTML; when working with wagtail.wagtailcore.rich_text.RichText objects, as wagtaildraftail now does, the filter has no effect (since the RichText.__html__ method deals with the conversion itself):

https://github.com/wagtail/wagtail/blob/0f5640b2129df9bea66f72d3107a495d70baa411/wagtail/wagtailcore/templatetags/wagtailcore_tags.py#L61-L63

(The only reason Wagtail's RichTextField still uses plain strings instead of RichText objects is backwards compatibility - there might be existing user code that assumes it can manipulate it as a string. Having seen how well it works here, though, I'm tempted to switch to RichText objects for Wagtail 2.0 now!)