Introduction

django-inline-media allows insertion of inline media content in your text fields. Based on django-basic-apps/inlines, it provives the following features:

  1. Inserts pictures and collection of pictures into your texts using the TextAreaWithInlines widget.
  2. Positions media content at different places and sizes (mini/small/medium/large at left/right or full at the left/center/right).
  3. Facilitates administration with thumbnails and search by tags, author and license.
  4. Shows a customised control to insert media content in text fields.
  5. Uses jquery prettyPhoto to show pictures and galleries when clicking on them.
  6. Tested under:
    • Python 2.7 and Python 3 (3.2, 3.4, 3.5, 3.6)
    • Django 1.8, Django 1.9 and Django 1.10

The following sample shows a centered inline picture set inserted in a text, on mouseover event the first 3 photos unfold:

_images/cover.png

Run the demo project to see django-inline-media in action.

Quick start

  1. Get the dependencies:

    $ pip install -r requirements.pip
    
  2. In your settings.py:

  • Add inline_media, sorl.thumbnail and tagging to INSTALLED_APPS.
  • Add THUMBNAIL_BACKEND = "inline_media.sorl_backends.AutoFormatBackend"
  • Add THUMBNAIL_FORMAT = "JPEG"
  1. Create a model with a field of type TextFieldWithInlines.
  2. Create an admin class for that model by inheriting from both inline_media.admin.AdminTextFieldWithInlinesMixin and Django’s admin.ModelAdmin.
  3. Optionally, customise inline_media templates by copying them from inline_media/templates/inline_media/ to your inline_media/ folder in your templates directory.
  1. Run manage.py commands: syncdb, collectstatic, runserver.
  2. Create two InlineType objects, one for the Picture model and one for the PictureSet model.
  3. Upload some pictures and create some picture sets.
  4. Add content to the model using the field TextFieldWithInlines and see that you can insert inline content in the textarea. It will be rendered in the position indicated by the CSS class selected in the dropdown box.
  5. Hit your app’s URL!

Run the demo in django-inline-media/examples/demo to see an example.

Indices and tables