Skip to content
Preview changes without saving the data into db
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
light_draft
static
.gitignore
.travis.yml
CHANGELOG
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
MANIFEST.in
Makefile
README.rst
requirements.txt
setup.py
tox.ini

README.rst

Django Light Draft

https://travis-ci.org/zerc/django-light-draft.svg?branch=master

Preview model changes without saving them into the database. Watch a demo on YouTube.

Requirements:

  • Django >= 1.8.x
  • Python >= 2.7.x

Quickstart

Instal the package via pip:

pip install django-light-draft

Add next lines to the settings.py of your project:

INSTALLED_APPS = (
    ...,
    'light_draft',
)

# Default settings. If you are happy with them - you can omit them.
DRAFT_SETTINGS = {
    'cache_name': 'default',  # or any other cache you may have
    'ttl': 60*5,
}

To make it work, you need to have at least default cache defined. If you are not familiar with this term check out documentation. In simpliest case you can enable in memory like this:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'just-an-example',
    }
}

Then, in order to enable the feature for a particular model you need to make sure:

  1. The admin model has been inherited from light_draft.admin.DraftAdmin:
from light_draft.admin import DraftAdmin

class MyModelAdmin(DraftAdmin):
    ...
  1. The detail view of your model has been inherited from light_draft.views.BaseDraftView:
from light_draft.views import BaseDraftView

class MyModelDetailView(BaseDraftView):
    ...
  1. The model has .get_absolute_url() method defined.

See example/blog app for more details.

Contributing

See CONTRIBUTING.md file for information how you can contribute to the project. Cheers!

Licence & Authors

The MIT License (MIT)

Copyright (c) 2014 Vladimir Savin.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.