A simple Django app to track create,update and delete actions.
Project description
DRF-HISTORY
drf-history is a simple django rest framework app to track actions performed in a django app. The actions being tracked are POST, DELETE, PUT and PATCH
Data being captured is
| Data | Description |
|---|---|
| user | The current loggedin user making the request |
| request data(body) | Data being sent (POST, PATCH and PUT) |
| response data | response data after the request is complete |
| table_name | name of the model the request is affecting |
| instance_id | The id of the created, updated or deleted model instance |
| method | The request method i.e POST, DELETE, PUT or PATCH |
| created_at | Date time object for when the request is being carried out |
Quick start
-
Add
track_actionsto your INSTALLED_APPS settingINSTALLED_APPS = [ ..., 'track_actions', ] -
Add
track_actions.requestMiddleware.RequestMiddlewarein settings under middlewaresMIDDLEWARE = [ ... , 'track_actions.requestMiddleware.RequestMiddleware', ] -
Run
python manage.py migrate track_actionsto create the History model.
To access the get history endpoint
In your project's url file
-
import track_actionsin your projects urls file -
Register the url in the urlpattern
path('track_actions/', include('track_actions.urls')) -
visit the url in the browser or on postman
http://127.0.0.1:8000/track_actions/history/you should be able to see all the recorded history if you haveadminpriveleges and you are authenticated.
Alternatively
You can create your own endpoint to view all history from the History model by importing it in your views or serializers.
from track_actions.models import History
NOTE
This package will only work if you have a user in a request and a user model in your database.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drf-history-0.0.2.tar.gz.
File metadata
- Download URL: drf-history-0.0.2.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4bbdf6e5919cbe19eaa5c30ddc787f7d2250747f5cbd03e303031df95977784
|
|
| MD5 |
75c3d7b7cec89dc07734f62bf17c29ee
|
|
| BLAKE2b-256 |
3b0b52bab174a417b860cfcec03086459abd7f0542dd90898d81b0dd5894c2f7
|
File details
Details for the file drf_history-0.0.2-py3-none-any.whl.
File metadata
- Download URL: drf_history-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
295af8a3b6afdb8a9528782751008cee54e3fccf34161137515f7e254d44b5bc
|
|
| MD5 |
db7364a0aa6d963be70b0d0a79cdeda3
|
|
| BLAKE2b-256 |
8b799374a61d45863dc6e11cb862a0f3244a6dc7cbc54206bdc797a42b9b33d6
|