jeverling
unread,Jul 4, 2008, 7:52:10 AM7/4/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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!