Library provides customization of AnonymousUser.
Works with Python >= 2.6, Python >= 3.2, Django >= 1.5.
pip install django-custom-anonymous
Add to `settings`:
AUTH_ANONYMOUS_MODEL = 'your_app.module.CustomAnonymousUser'
Add to middlewares:
MIDDLEWARE_CLASSES = (
Create your own anonymous (for example):
from django.contrib.auth.models import AnonymousUser as DjangoAnonymousUser
ip = None
def __init__(self, request):
self.ip = request.META.get('REMOTE_ADDR')
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.