Library provides customization of AnonymousUser in Django
Project description
# django-custom-anonymous
[![Build Status](https://travis-ci.org/bugov/django-custom-anonymous.svg?branch=master)](https://travis-ci.org/bugov/django-custom-anonymous)
Library provides customization of AnonymousUser.
Works with Python >= 2.6, >= 3.2, Django >= 1.5, >= 2.0.
## Installation
pip install django-custom-anonymous
## Customization
Add to `settings`:
AUTH_ANONYMOUS_MODEL = 'your_app.module.CustomAnonymousUser'
Add to middlewares:
MIDDLEWARE = (
...
'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__()
[![Build Status](https://travis-ci.org/bugov/django-custom-anonymous.svg?branch=master)](https://travis-ci.org/bugov/django-custom-anonymous)
Library provides customization of AnonymousUser.
Works with Python >= 2.6, >= 3.2, Django >= 1.5, >= 2.0.
## Installation
pip install django-custom-anonymous
## Customization
Add to `settings`:
AUTH_ANONYMOUS_MODEL = 'your_app.module.CustomAnonymousUser'
Add to middlewares:
MIDDLEWARE = (
...
'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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dcd09b82de5d1a594b0f03f2943705cfa40e22a28056ed13543ab014fc05843 |
|
MD5 | ba206bb184ee2ebd9faf54488f4ef309 |
|
BLAKE2b-256 | 70cacef6220d62de5ba37b0c971948c787704752cad5a14a1a610709e65a811f |