wagtail / django-modelcluster

Django extension to allow working with 'clusters' of models as a single unit, independently of the database
BSD 3-Clause "New" or "Revised" License
485 stars 66 forks source link

ClusterForm.as_p should return a safe string #145

Closed gasman closed 2 years ago

gasman commented 3 years ago

ClusterForm overrides as_p to include child formsets in the form rendering:

https://github.com/wagtail/django-modelcluster/blob/62dae96cfb870b23a92c1559f67646c24caff869/modelcluster/forms.py#L313-L315

However, it returns a plain string rather than a SafeString instance - probably due to the use of ''.join - so outputting {{ form.as_p }} on a template causes the HTML to be escaped.