Posts

Showing posts from June, 2013

Editor TinyMCE in Django admin

Image
  Let stepwise Make the   download of TinyMCE Create folder structure template Configure   TEMPLATE_DIRS   in   settings.py   of your project (   example below   ) Edit the urls.py Edit admin.py Create configuration file TinyMCE  1. Download TinyMCE   you can download tinymce from http://www.tinymce.com/download/download.php 2.   Structure The folder structure is something like: project app templates css js tinymce     Place the folder inside tinymce   project> templates> js   , as shown above. 3.   TEMPLATE_DIRS (settings.py) Edit the   settings.py   and edit / add these lines: import the . path   TEMPLATE_DIRS = ( the . path . join ( the . path . dirname ( __file__ ) , 'templates' ) , ) 4.   Serving static files Open the file   urls.py   (the project root) and add the line 3 as below: urlpatterns = patterns ( '' , ... ( r '^ js / (? <path> P. *) $' ,

Django Dynamic Formsets with Jquery

If you have an existing project, it's quite easy to add client-side support for adding and removing forms. I'll assume you've already created your formset. You can create formsets using any of the provided methods: both regular formsets (created with the ``formset_factory``) and inline formsets (created with the ``inlineformset_factory``) are supported. 1. First, copy ``jquery.formset.js`` to your ``MEDIA_ROOT``; don't    forget to include the jQuery library too! 2. Include a reference to the script in your template; again, remember    to reference the jQuery library, before including the script. 3. Render the formset as you would normally -- I usually use a table    but you can use DIVs, Ps or whatever you desire. Let's use the    example markup below:: <form id="myForm" method="post" action="">            <table border="0" cellpadding="0" cellspacing="0">