Configuration — django-guardian v0.2.2 documentation

### Navigation

- index
- modules |
- next |
- previous |
- django-guardian v0.2.2 documentation »

# Configuration

After installation we can prepare our project for object permissions handling. In a settings module we need to add guardian to `INSTALLED_APPS`:

    INSTALLED_APPS = (
        # ...
        'guardian',
    )

and hook guardian’s authentication backend:

    AUTHENTICATION_BACKENDS = (
        'django.contrib.auth.backends.ModelBackend', # this is default
        'guardian.backends.ObjectPermissionBackend',
    )

As `django-guardian` supports anonymous user’s object permissions we also need to add following to our settings module:

    ANONYMOUS_USER_ID = -1

Note

Once project is configured to work with `django-guardian`, calling `syncdb` management command would create `User` instance for anonymous user support (with name of `AnonymousUser`).

We can change id to whatever we like. Project should be now ready to use object permissions.

### Navigation

- index
- modules |
- next |
- previous |
- django-guardian v0.2.2 documentation »