Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Documented ANONYMOUS_DEFAULT_USERNAME_VALUE configuration

  • Loading branch information...
commit d414e2f0a138df1dfbe0f9a2e083994c4ab17bff 1 parent 29e1198
@lukaszb lukaszb authored
Showing with 18 additions and 1 deletion.
  1. +16 −0 docs/configuration.rst
  2. +2 −1  guardian/conf/settings.py
View
16 docs/configuration.rst
@@ -88,3 +88,19 @@ Tells parts of guardian what template to use for responses with status code
``403`` (i.e. :ref:`api-decorators-permission_required`). Defaults to
``403.html``.
+
+.. setting:: ANONYMOUS_DEFAULT_USERNAME_VALUE
+
+ANONYMOUS_DEFAULT_USERNAME_VALUE
+--------------------------------
+
+.. versionadded:: 1.1
+
+Due to changes introduced by Django 1.5 user model can have differently named
+``username`` field (it can be removed too, but ``guardian`` currently depends
+on it). After ``syncdb`` command we create anonymous user for convenience,
+however it might be necessary to set this configuration in order to set proper
+value at ``username`` field.
+
+.. seealso:: https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#substituting-a-custom-user-model
+
View
3  guardian/conf/settings.py
@@ -2,7 +2,8 @@
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
-ANONYMOUS_DEFAULT_USERNAME_VALUE = getattr(settings, 'ANONYMOUS_DEFAULT_USERNAME_VALUE', 'AnonymousUser')
+ANONYMOUS_DEFAULT_USERNAME_VALUE = getattr(settings,
+ 'ANONYMOUS_DEFAULT_USERNAME_VALUE', 'AnonymousUser')
ANONYMOUS_USER_ID = getattr(settings, 'ANONYMOUS_USER_ID', None)
if ANONYMOUS_USER_ID is None:
raise ImproperlyConfigured("In order to use django-guardian's "
Please sign in to comment.
Something went wrong with that request. Please try again.