Decorators
switch_off(name, redirect_to=None)
Controls access to the decorated view based on the active variant of the given experiment.
If the active variant is 'off', the view will be executed. Otherwise the user agent will be redirected to the specified redirect target, or will receive a 404 if no redirect is provided.
| Parameters: |
|
|---|
redirect_to can be any type allowed by Django redirects:
- A view name.
reverse()will be used to get the redirect URL. Arguments are not supported. - A model that defines
get_absolute_url. - An absolute or relative URL.
Redirects will be temporary only (302).
| Returns: |
|
|---|
| Raises: |
|
|---|
switch_on(name, redirect_to=None)
Controls access to the decorated view based on the active variant of the given experiment.
If the active variant is 'on', the view will be executed. Otherwise the user agent will be redirected to the specified redirect target, or will receive a 404 if no redirect is provided.
| Parameters: |
|
|---|
redirect_to can be any type allowed by Django redirects:
- A view name.
reverse()will be used to get the redirect URL. Arguments are not supported. - A model that defines
get_absolute_url. - An absolute or relative URL.
Redirects are temporary (302).
| Returns: |
|
|---|
| Raises: |
|
|---|
variant(name, variant, redirect_to=None)
Controls access to the decorated view based on the active variant of the given experiment.
If the given variant or variants are active, the view will be executed. If the variant is not a match, the user agent will be redirected to the specified redirect target, or will receive a 404 if no redirect is provided.
| Parameters: |
|
|---|
redirect_to can be any type allowed by Django redirects:
- A view name.
reverse()will be used to get the redirect URL. Arguments are not supported. - A model that defines
get_absolute_url. - An absolute or relative URL.
Redirects are temporary (302).
| Returns: |
|
|---|
| Raises: |
|
|---|