Search code examples
pythondjangowysihtml5django-wysihtml5

How to use django-wysihtml5 in frontend forms?


I'm using django-wysihtml5 to get rich text functionality in the admin and it works well.

I'd like to know if there is any option in order to also get the same functionality in the forms used in frontend (not only admin) using this django library. Maybe do we have to specify a widget in ModelForm __init__() method?

Thanks a lot!


Solution

  • The sample project in django-wysihtml5 now implements the use case you are looking for. It uses bootstrap-wysihtml5 for the public interface.

    The key files doing the work are:

    • demo/twitter_bootstrap.py: Implements the django widget used in the ModelForm
    • demo/articles/forms.py: Implements the ModelForm for Article

    To see the demo in action create a virtualenv, git clone the app, and follow the steps to install the demo site.