Skip to main content

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)

Project details


Download files

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

Source Distribution

django-aloha-0.0.1.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file django-aloha-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-aloha-0.0.1.tar.gz
Algorithm Hash digest
SHA256 41ed580d2b6261e49ccdb98b2034850ddf8d75d24ddef6fd0600d15a1d4f34df
MD5 82794148856c935a115c538771a123c6
BLAKE2b-256 985459f6cceb562cde71d0e3d8eb3b6bf9077e4e4578eb72ba0cb214672ed76f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page