Search code examples
pythondjangowysiwygdjango-cmswagtail-streamfield

Analogs for Placeholder from Django-CMS or Streamfield from Wagtail without cms itself


I often need to implement rich content editing in my django projects. There are a lot of different wysiwyg-editors, but they are not good for creating complex content structure. Placeholder from Django-CMS or Streamfield from Wagtail can do it much better, but I don't want to add whole CMS to my project, because it brings a lot of unnecessary stuff into interface.

All I need is just a field with ordered list of widgets inside + editing interface for it. Can you suggest something?


Solution

  • Django CMS is very modular - you do not need to bring in the whole URL and page management interface.

    You can enhance your existing models with Django CMS's placeholder fields and use the rich structure mode and plugins only, for example:

    from django.db import models
    from cms.models.fields import PlaceholderField
    
    class MyModel(models.Model):
        # your fields
        my_placeholder = PlaceholderField('placeholder_name')
        # your methods
    

    Example taken from Django CMS documentation.