Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Cannot add conditions in Nexus #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ filters registered to the ``User`` model, as well as IP address (using RequestCo

from gargoyle.decorators import switch_is_active

@switch_is_active('my switch name')
@switch_is_active('my_switch_name')
def my_view(request):
return 'foo'

In the case of the switch being inactive and you are using the decorator, a 404 error is raised. You may also redirect
the user to an absolute URL (relative to domain), or a named URL pattern::

# if redirect_to starts with a /, we assume it's a url path
@switch_is_active('my switch name', redirect_to='/my/url/path)
@switch_is_active('my_switch_name', redirect_to='/my/url/path)

# alternatively use the url mapper
@switch_is_active('my switch name', redirect_to='access_denied')
@switch_is_active('my_switch_name', redirect_to='access_denied')

gargoyle.is_active
~~~~~~~~~~~~~~~~~~
Expand All @@ -34,7 +34,7 @@ to perform validation on your own custom objects::
from gargoyle import gargoyle

def my_function(request):
if gargoyle.is_active('my switch name', request):
if gargoyle.is_active('my_switch_name', request):
return 'foo'
else:
return 'bar'
Expand All @@ -43,7 +43,7 @@ to perform validation on your own custom objects::
from gargoyle import gargoyle

def my_method(user):
if gargoyle.is_active('my switch name', user):
if gargoyle.is_active('my_switch_name', user):
return 'foo'
else:
return 'bar'
Expand All @@ -63,7 +63,7 @@ If you prefer to use templatetags, Gargoyle provides a helper called ``ifswitch`

``ifswitch`` can also be used with custom objects, like the ``gargoyle.is_active`` method::

{% ifswitch "my switch name" user %}
{% ifswitch "my_switch_name" user %}
"my switch name" is active!
{% endifswitch %}

Expand Down