A package for adding a django-reversion history endpoint to django-rest-framework ModelViewSet
Project description
django-reversion-rest-framework
A package for adding a django-reversion history endpoint to django-rest-framework ModelViewSet.
Configuration
Follow the official website for the installation and the integration of django-reversion in your project, otherwise future steps won't work.
You might need to enable the ReversionMiddleware
for storing a version for each API change.
Follow the instructions here,
you should add 'reversion.middleware.RevisionMiddleware'
to your MIDDLEWARE
setting.
Using the HistoryModelViewSet
The HistoryModelViewSet
extends django-rest-framework's ModelViewSet
adding a GET history
action in the detail,
displaying a list of all revisions of that specific record.
You can use the HistoryModelViewSet
in place of the ModelViewSet
during viewsets definition.
from reversion_rest_framework.viewsets import HistoryModelViewSet
class MyModelViewSet(HistoryModelViewSet):
# ...
Then if your endpoint exposes on the url /my-models/
you can get the history
of a record using my-models/<pk>/history/
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-reversion-rest-framework-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 026377790d23f58f890c2965bb73846a9b411d40dabab642a2cbd7aa18d809fd |
|
MD5 | 4cafdb254c472a8ca9f98793b9fcbe10 |
|
BLAKE2b-256 | cfd0a8c0d54ea492cb0f20dad189951adf72d02a00d09e186822acbb3a44d375 |
Hashes for django_reversion_rest_framework-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59caca1f810825cf857a221dbe7c81692e07d2aa1b5c557e83ea24f615ad0ca9 |
|
MD5 | 0a94d39aa2a0dd425d8f2a4dd50e1e36 |
|
BLAKE2b-256 | d6e6fc4770ab86a7ce2d34715e7d6a195690ef84676ddbdcb84cebaa74f87d2f |