Enabling WYMeditor for flatpages

53 views
Skip to first unread message

jeverling

unread,
Jul 4, 2008, 7:52:10 AM7/4/08
to byteflow-users
Hello all!

I thought this might be useful for other people.
To enable the wysiwyg-editor for flatpages, you have to override an
admin-template.
You can do this by creating the following folder inside your templates
folder:
./admin/flatpages/flatpage

Now copy the template "change_form.html" from [DJANGO-PATH]/contrib/
admin/templates/admin to the new folder.
To show the wysiwyg-editor for the correct field ("id_content"), you
have to include these three lines:

<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/wymeditor/
jquery.wymeditor.pack.js"></script>
<script type="text/javascript">

$(document).ready(function() {
$('head', document).append('<link rel="stylesheet" type="text/css"
media="screen" href="{{ STATIC_URL }}js/wymeditor/skins/default/
screen.css" />');

$("#id_content").wymeditor({
updateSelector: "input:submit",
updateEvent: "click",
postInit: function() {
//alert('OK');
}
});
});

For wysiwyg in the admin-view for posts, Byteflow goes another route,
by supplying custom javascript to the Admin class in the model
definition.
I tried to do the same, but run into difficulties, because the
flatpage model is defined elsewhere.
So I chose to just change the template.

Maybe this is helpful to somebody.

Best Regards,

Jesaja Everling!

Alexander Solovyov

unread,
Jul 7, 2008, 2:43:30 AM7/7/08
to byteflo...@googlegroups.com
On Fri, Jul 4, 2008 at 2:52 PM, jeverling <jeve...@gmail.com> wrote:
> Maybe this is helpful to somebody.

Thanks for instructions, they are really useful. :)

--
Alexander

Reply all
Reply to author
Forward
0 new messages