Skip to content

Instantly share code, notes, and snippets.

@gustavcaves
Forked from hcosta/custom_ckeditor.md
Created March 15, 2021 20:36
Show Gist options
  • Save gustavcaves/ab28fb6291bb99aef6951ab65ba33179 to your computer and use it in GitHub Desktop.
Save gustavcaves/ab28fb6291bb99aef6951ab65ba33179 to your computer and use it in GitHub Desktop.
Código para conseguir ancho adaptativo en django-ckeditor

static/pages/css/custom_ckeditor.css

.django-ckeditor-widget, .cke_editor_id_content {
    width: 100% !important;
    max-width: 821px !important;
}

Inyectar en pages_menu.html

<link href="{% static 'pages/css/custom_ckeditor.css' %}" rel="stylesheet">

Inyectar en admin.py

from django.contrib import admin
from .models import Page

class PageAdmin(admin.ModelAdmin):
    list_display = ('title', 'order')
    
    # Inyectamos nuestro fichero css
    class Media:
        css = {
            'all': ('pages/css/custom_ckeditor.css',)
        }
        
admin.site.register(Page, PageAdmin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment