Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Draft in admin

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 draft
Octocat-spinner-32 AUTHORS
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.md
Octocat-spinner-32 setup.py
README.md

Django-Draft

Allow the creation of drafts in the admin. It is compatible with both the default django admin and django-grappelli.

Installation

pip install git+git://github.com/platypus-creation/django-draft.git

or:

git clone git://github.com/platypus-creation/django-draft.git
cd django-draft
python setup.py install

Add draft to your INSTALLED_APPS

INSTALLED_APPS = (
    ...
    'draft',
)

Create the database table

python manage.py syncdb

or if you are using South (you should)

python manage.py migrate draft

You are done.

Django-draft detects if grappelli is installed and will display accordingly.

Usage

Add draft support in the admin to your model by registering them with a DraftAdmin Class which inherits the ModelAdmin Class

from myapp.models import MyModel
from draft.admin import DraftAdmin

class MyModelAdmin(DraftAdmin):
    """
    Declare everything as usual here
    """
    pass


admin.site.register(MyModel, MyModelAdmin)

You should now have a save as draft button available in the admin for this model !

As soon as you have a draft, you'll be able to reload it later, or discard it

Under the hood

Django draft save the serialized current form and is able to reload it later. It has no knowledge of your models whatsoever, it simply saves a query dict and is able to reload it in Javascript.

Something went wrong with that request. Please try again.