Code

Changes between Version 6 and Version 7 of AddWYSIWYGEditor


Ignore:
Timestamp:
12/20/06 11:24:10 (7 years ago)
Author:
Nicolas Lara
Comment:

Using TinyMCE with flatpages

Legend:

Unmodified
Added
Removed
Modified
  • AddWYSIWYGEditor

    v6 v7  
    7272Basically '''js''' option includes tuple items as !JavaScript files in the header of CRUD pages for this model (see [http://www.djangoproject.com/documentation/model_api/#admin-options Django Model Reference / Admin Options]). The first script is the main TinyMCE file. '' If you use TinyMCE compressor, include '/tiny_mce/tiny_mce_gzip.php' instead.'' The second script is your configuration file created in step !#2. 
    7373 
     74---- 
     75 
     76=== Using TinyMCE with flatpages === 
     77 
     78If you want to use TinyMCE in the admin's textarea for flatpages this thing is a little bit different because you don't have direct access to the model (unless you modify the contrib code which would cause difficulties when upgrading Django). So one way of doing this is to extend the flatpage's admin template.  
     79 
     80To do so you need to: 
     81  * Create the directory <your_template_dir>/admin_copies/ 
     82  * Copy <your_django_source>/contrib/admin/templates/admin/change_form.html  to <your_template_dir>/admin_copies/   This is needed because you are going to extend it and can't access the admin template directly from your local template (acctually a symlink would work fine if you're working in some *nix) 
     83  * Create the directory <your_template_dir>/admin/flatpages/flatpage/ 
     84  * Create a template in that directory called change_form.html that extends the original admin template 
     85here's mine: 
     86{{{ 
     87{% extends "admin_copies/change_form.html" %} 
     88{% block extrahead %}{{ block.super }} 
     89<script type="text/javascript" src="/site-media/js/tiny_mce/tiny_mce.js"></script> 
     90<script type="text/javascript" src="/site-media/js/tiny_mce/textareas.js"></script> 
     91{% endblock %} 
     92}}} 
     93 
     94 
     95---- 
     96 
    7497That's it. 
    7598