Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

django app to easily integrate editing with Aloha WYSIWIG editor in django apps.

Project Description

What is django-aloha

django-aloha is a django app to easily integrate editing with Aloha WYSIWIG editor in django apps.

You just edit the blocks of text on your pages, no admin needed.

How it works

django-aloha wraps editable text fields into separate forms. See how to do it in the “Usage” section.

Installation

  1. download aloha-editor from GitHub https://github.com/alohaeditor/Aloha-Editor

    my version was commit 787859e2313337f171f32b7574cec23393fa6a77

  2. For existing JS and CSS to work (this is optional, you can create your own ones) place the aloha files into your {{MEDIA_URL}}js/aloha/, so that the “lib” directory is in {{MEDIA_URL}}js/aloha/lib/.

  3. Install django-aloha into your python:

    easy_install django-aloha
    
  4. Add “django-aloha” to INSTALLED_APPS in settings.py

  5. Make sure you have jquery enabled.

  6. (Optional) add existing JS and CSS to your templates, where you usually place JS and CSS:

    {% include 'aloha/includes/js.html' %}
    {% include 'aloha/includes/css.html' %}
    

    Or you can just copy these files into your TEMPLATES dir, and edit according to your needs.

Usage

Use in your templates like this.

  1. Option one - you want to edit a certain field on a model instance:

    {% load aloha_tags %}
    
    {% aloha my_object_from_the_database 'fieldname_where_text_is' [url_to_save] %}
       {{ my_object_from_the_database.fieldname_where_text_is|safe }}
    {% endaloha %}
    

    If you want, you can add an optional “url” parameter to do custom POST processing. If not provided, aloha.views.save will be used.

  2. Option two - you want to edit arbitrary text, and optionally, provide and url to save it:

    {% load aloha_tags %}
    
    {% aloha [url_to_save_to] %}
       <p>Place here what you want to edit</p>
    {% endaloha %}
    

The custom save URL should process POST requests, and accepts following parameters:

  • object_name
  • field_name
  • object_pk
  • content

All of these are generated by the tag, no need to worry about them.

TODO

  • Add more strict permission processing (not it just uses request.user.is_staff to check for permissions)
  • Process thourgh AJAX instead of raw POSTS (to protect data loss on errors)
Release History

Release History

This version
History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-aloha-0.0.1.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Jan 25, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting