Library provides customization of AnonymousUser in Django
Project description
# django-custom-anonymous
Library provides customization of AnonymousUser.
Works with Python >= 2.6, Python >= 3.2, Django >= 1.5.
## 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.
Works with Python >= 2.6, Python >= 3.2, Django >= 1.5.
## 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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0567ec71b4895ffdaaadfa3f34ceac662a3e23fb6b1cf3cb00f20b71f3fb357 |
|
MD5 | 44d69120395b98d1b8c9f5d4b12385df |
|
BLAKE2b-256 | ed60af0f9ab986943296a8f21283f309401c37d972e359dd7bd87d5eeedf741a |