Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/platypus-creation/django-draft
Draft in admin
https://github.com/platypus-creation/django-draft
Last synced: 3 months ago
JSON representation
Draft in admin
- Host: GitHub
- URL: https://github.com/platypus-creation/django-draft
- Owner: platypus-creation
- License: other
- Created: 2011-08-13T23:41:21.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-08-14T16:28:06.000Z (over 13 years ago)
- Last Synced: 2024-08-23T04:53:07.209Z (4 months ago)
- Language: Python
- Size: 97.7 KB
- Stars: 15
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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 installAdd `draft` to your INSTALLED_APPS
INSTALLED_APPS = (
...
'draft',
)Create the database table
python manage.py syncdbor 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 DraftAdminclass 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.