Utilities¶
django-sitegate provides some utility functions for your convenience.
@sitegate_view¶
This decorator is a shortcut comprising three basic decorators:
- @signin_view
- @signup_view
- @redirect_signedin
This decorator can accept the same keyword arguments as @signin_view and @signup_view:
@redirect_signedin¶
sitegate knowns that in most cases you don't want users to access sign in and sign up pages after they are logged in,
so it gives you @redirect_signedin decorator for your views:
Note
This decorator redirects logged in users to another location, when they try to access the page.
Default redirect URL is a site root — /
The decorator accepts the same parameters as redirect from django.shortcuts.
It means that you can instruct it where logged in users should be redirected to:
USER¶
Django 1.5 introduces custom user model support. To be compatible with that, sitegate is equipped
with USER variable which resides in sitegate.utils. It will always address the appropriate User model,
so that you can use it in your sign up and sign in flows and forms.
Warning
Please note, that sitegate with its' build-in sign in/up flows relies on the fact that User model has some basic attributes: username, email, password, is_active, set_password.