Library provides customization of AnonymousUser in Django
Project description
# django-custom-anonymous
Library provides customization of AnonymousUser.
## Installation
pip install django-custom-anonymous
## Customization
Add to `settings`:
AUTH_ANONYMOUS_MODEL = 'your_app.module.CustomAnonymousUser'
Add to middlewares:
MIDDLEWARE_CLASSES = (
...
'custom_anonymous.middleware.AuthenticationMiddleware',
...
)
Create your own anonymous (for example):
from django.contrib.auth.models import AnonymousUser as DjangoAnonymousUser
class CustomAnonymousUser(DjangoAnonymousUser):
ip = None
def __init__(self, request):
self.ip = request.META.get('REMOTE_ADDR')
super(AnonymousUser, self).__init__()
Library provides customization of AnonymousUser.
## Installation
pip install django-custom-anonymous
## Customization
Add to `settings`:
AUTH_ANONYMOUS_MODEL = 'your_app.module.CustomAnonymousUser'
Add to middlewares:
MIDDLEWARE_CLASSES = (
...
'custom_anonymous.middleware.AuthenticationMiddleware',
...
)
Create your own anonymous (for example):
from django.contrib.auth.models import AnonymousUser as DjangoAnonymousUser
class CustomAnonymousUser(DjangoAnonymousUser):
ip = None
def __init__(self, request):
self.ip = request.META.get('REMOTE_ADDR')
super(AnonymousUser, self).__init__()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-custom-anonymous-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0dcf305d5e5ff1ec9442e26f398e008d803c8b47b33f98153b6d03b5b3dcf62 |
|
MD5 | 6c5fba29f07789c3378d72ee33811608 |
|
BLAKE2b-256 | 4e1f49e417abfe781f045625698ee169c395682b7f02515fe6cd7dcd300a7d64 |