Library provides customization of AnonymousUser in Django
Project description
django-custom-anonymous
.. figure:: https://travis-ci.org/bugov/django-custom-anonymous.svg?branch=master
Library provides customization of AnonymousUser.
Works with Python >= 2.6, >= 3.2, Django >= 1.5, >= 2.0.
Installation
.. code:: bash
pip install django-custom-anonymous
Customization
Add to settings
:
.. code:: python
AUTH_ANONYMOUS_MODEL = 'your_app.module.CustomAnonymousUser'
Add to middlewares:
.. code:: python
MIDDLEWARE = (
...
'custom_anonymous.middleware.AuthenticationMiddleware',
...
)
Create your own anonymous (for example):
.. code:: python
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
File details
Details for the file django-custom-anonymous-0.5.0.tar.gz
.
File metadata
- Download URL: django-custom-anonymous-0.5.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aeca8f07f6534be0fedb7255d1bb053e22de7380654e8a4a98604b08d57e362 |
|
MD5 | 08b6905db1319ffbd7dc81397de24961 |
|
BLAKE2b-256 | 5b263ab8318be8e9d7c4928093353ab2356fec62a054117c09e56bd00cad866d |