Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TyniMCE didn't work. How the best Django rich text editor to use with Material-Admin? #177

Open
Paulo-AndradeDev opened this issue Dec 24, 2022 · 2 comments

Comments

@Paulo-AndradeDev
Copy link

Hi there!

I need to replace textarea with rich text editor in Django Admin.

I tryed out the TyniMCE lib.

However the TyniMCE rich text editor do not work when I use the "material.admin" app. The Django admin only display the text editor if I unregister the "material.admin" app. I figured out that they are “incompatible with each other. I guess, the Django-material-admin overrides the tyniMCE's CSS/Js.

How to solve that problem
or
which are the best Django rich text editor to use while use Material-Admin (material.admin" app) as well? Or

Thanks in advance.

@SumitSingh-sng
Copy link

You can use the javascript version of TinyMCE and embed it in your project.

@xFrann
Copy link

xFrann commented Sep 30, 2024

in the admin.py file please add a form overide and use the model provided by tinyMCE

@admin.register(Post)
class PostAdmin(ModelAdmin):
    list_display = ('title', 'slug', 'publish', 'created')
    list_filter = ('created', 'publish')
    search_fields = ('title', 'content')
    prepopulated_fields = {'slug': ('title',)}
    date_hierarchy = 'publish'
    ordering = ('-publish',)

    formfield_overrides = {
        tinymce.models.HTMLField: {'widget': TinyMCE(attrs={'cols': 80, 'rows': 30})},
    }

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants