djangodjango-admin

YAML text editor field in Django


I am looking for a convenient way to write and edit YAML in Django admin panel. Are there any text editors in django admin panel for YAML


Solution

  • solved by integrating django-ace field and in this we have support for CSS, python, HTML etc also.

    #settings.py

    INSTALLED_APPS = (
        # ...
        'django_ace',
    )
    

    #forms.py

    from django import forms
    from django_ace import AceWidget
    
    class EditorForm(forms.Form):
        text = forms.CharField(widget=AceWidget)
    

    #admin.py

    from django.contrib import admin
    from django.contrib.admin import ModelAdmin
    # Import form here
    
    @admin.register(models.EditorModel)
    class EditorModelAdmin(ModelAdmin):
        form = forms.EditorForm