Adding Tinymce to Admin

49 views
Skip to first unread message

Ankush Thakur

unread,
Jun 8, 2016, 12:56:32 PM6/8/16
to django...@googlegroups.com
I wish to add TinyMCE editor to my Django-powered app. My Model is a typical blog model, with a TextField for the actual post contents. Now what I want is, every time I'm editing the contents (or adding a new blog), I should be able to write in a WordPress-style editor. 

I understand that I'd need to add some third-party app for TinyMCE and then set it as a widget, but my problem is that the admin templates do not reside in my project Git repository. They are in the virtualenv directory, and I'm not sure how I'll be able to integrate them into my project.

A little voice at the back of my head tells me that I won't need to alter Admin, but I'm not sure. Because I don't have any forms (I directly edit/create from the Admin), I don't think I can get away with only saying something like 'content = models.TextField(widget='tinymce')'?

Regards,
Ankush Thakur

ludovic coues

unread,
Jun 9, 2016, 4:50:04 AM6/9/16
to django...@googlegroups.com

I'm pretty sure you can specify a widget to use in admin for each model and field.

Part 7 of the tutorial will show you how to alter the admin without changing the file in the virtualenv.
The documentation on ModelAdmin have an example of what you are trying to do :)

+33614874342

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALX%3DrKLBResPR-n8SCibpckFAN5PwhHWSH5xBgEnmPaGLUvsrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

jorr...@gmail.com

unread,
Jun 9, 2016, 7:45:52 AM6/9/16
to Django users

Ankush Thakur

unread,
Jun 9, 2016, 1:35:16 PM6/9/16
to Django users
Ah, yes! I entirely forgot about admin.py, my head swirling with too many concepts to remember. Let me work on that see how it goes. Thanks! :-)

~~Ankush

Ankush Thakur

unread,
Jun 9, 2016, 1:35:56 PM6/9/16
to Django users
Nope. And you know why, coz I'm an idiot! :P

Will try this and post here if I run into problems. Thanks a ton!

~~Ankush
Reply all
Reply to author
Forward
0 new messages