Django helper app for logging ID.
Project description
Kantan log is a simple Django helper app. This app supports logging to Django Model’s created_by, updated_by. At http requests interception, too.
Installation
shell>pip install djangokantanlog
Usage
Installed apps:
INSTALLED_APPS = [
...
'kantanlog.apps.KantanlogConfig',
]
Middleware:
MIDDLEWARE = [
...
'kantanlog.middlewares.KantanlogMiddleware',
]
Settings
KLOG_TARGET_APP_LABELS
Default: ()
Target apps, settings as app-label:
KLOG_TARGET_APP_LABELS = (
...
'myapp',
)
KLOG_BACKEND
Default: kantanlog.backends.KantanlogDefaultBackend
As interface, getting user.
e.g.
# at settings.py
KLOG_BACKEND = 'dotted.path.to.MyappBackend'
...
# -*- coding: utf8 -*-
from logging import getLogger
from kantanlog.backends import KantanlogDefaultBackend
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework_jwt.settings import api_settings
logger = getLogger(__name__)
payload_handler = api_settings.JWT_PAYLOAD_HANDLER
encode_handler = api_settings.JWT_ENCODE_HANDLER
class MyappBackend(KantanlogDefaultBackend):
def __init__(self):
super().__init__()
def get_user(self, request):
user = super().get_user(request)
if user.is_authenticated:
return user
ja = JSONWebTokenAuthentication()
if ja.get_jwt_value(request):
user, jwt = ja.authenticate(request)
return user
return user
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 djangokantanlog-0.0.4.tar.gz.
File metadata
- Download URL: djangokantanlog-0.0.4.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fe0bbd02b2c530144003f6d6ae33a62ce3f47a014a78c36358a6ca683db2dbd
|
|
| MD5 |
fb1b3fec8935e55586f21c8222800c1e
|
|
| BLAKE2b-256 |
49ae2c89469059cde8b5ead2bf3a128e048d5a44d62c598eb434fca8600505fb
|
File details
Details for the file djangokantanlog-0.0.4-py3-none-any.whl.
File metadata
- Download URL: djangokantanlog-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1af9ba823d41da05b21f34bbd0012bdc365b832cb4feab543657e796bc7f1068
|
|
| MD5 |
8aca078bd720b54da6156098c1b02a0e
|
|
| BLAKE2b-256 |
c4318ace7bb1906aeaa18a57eca3b5994e7dd9d88393938dc632344d127b6de6
|