Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zerc/django-light-draft
Preview changes without saving the data into the database
https://github.com/zerc/django-light-draft
django django-application preview python python2 python3
Last synced: 23 days ago
JSON representation
Preview changes without saving the data into the database
- Host: GitHub
- URL: https://github.com/zerc/django-light-draft
- Owner: zerc
- License: mit
- Created: 2014-07-14T17:05:39.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-02-10T21:12:07.000Z (over 1 year ago)
- Last Synced: 2024-10-01T06:21:44.595Z (about 1 month ago)
- Topics: django, django-application, preview, python, python2, python3
- Language: Python
- Homepage:
- Size: 189 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
.. image:: https://raw.githubusercontent.com/zerc/django-light-draft/master/example/blog/static/images/DLD.png
:alt: Django Light Draft.. image:: https://travis-ci.org/zerc/django-light-draft.svg?branch=master
:target: https://travis-ci.org/zerc/django-light-draft
.. image:: https://codecov.io/gh/zerc/django-light-draft/branch/master/graph/badge.svg
:target: https://codecov.io/gh/zerc/django-light-draft
Preview model changes without saving them into the database. `Watch a demo `_ on YouTube.Requirements:
* Django >= 1.8.x
* Python >= 2.7.xQuickstart
----------Instal the package via ``pip``:
.. code:: shell
pip install django-light-draft
Add next lines to the ``settings.py`` of your project:
.. code:: python
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:
.. code:: python
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``:
.. code:: python
from light_draft.admin import DraftAdmin
class MyModelAdmin(DraftAdmin):
...2. The detail view of your model has been inherited from ``light_draft.views.BaseDraftView``:
.. code:: python
from light_draft.views import BaseDraftView
class MyModelDetailView(BaseDraftView):
...3. 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.