Skip to content

Commit

Permalink
Improved API documentation (#539)
Browse files Browse the repository at this point in the history
Added missing attributes and methods.
  • Loading branch information
dancergraham authored Dec 20, 2024
1 parent a85782b commit 2dd8fac
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# html_static_path = ['_static']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down
34 changes: 22 additions & 12 deletions docs/types/flag.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,33 @@ Flag Attributes
Flags can be administered through the Django `admin site`_ or the
:ref:`command line <usage-cli>`. They have the following attributes:

:Name:
:name:
The name of the flag. Will be used to identify the flag everywhere.
:Everyone:
:everyone:
Globally set the Flag, **overriding all other criteria**. Leave as
*Unknown* to use other criteria.
:Testing:
:testing:
Can the flag be specified via a querystring parameter? :ref:`See
below <types-flag-testing>`.
:Percent:
:percent:
A percentage of users for whom the flag will be active, if no other
criteria applies to them.
:Superusers:
:superusers:
Is this flag always active for superusers?
:Staff:
:staff:
Is this flag always active for staff?
:Authenticated:
:authenticated:
Is this flag always active for authenticated users?
:Languages:
:languages:
Is the ``LANGUAGE_CODE`` of the request in this list?
(Comma-separated values.)
:Groups:
:groups:
A list of group IDs for which this flag will always be active.
:Users:
:users:
A list of user IDs for which this flag will always be active.
:Rollout:
:rollout:
Activate Rollout mode? :ref:`See below <types-flag-rollout>`.
:Note:
:note:
Describe where the flag is used.

A Flag will be active if *any* of the criteria are true for the current
Expand All @@ -85,6 +85,16 @@ are in the group *or* if they are in the 12%.
the actual proportion of users for whom the Flag is active will
probably differ slightly from the Percentage value.

Flag Methods
============

The Flag class has the following public methods:

:is_active:
Determines if the flag is active for a given request. Returns a boolean value.
:is_active_for_user:
Determines if the flag is active for a given user. Returns a boolean value.


.. _types-flag-custom-model:

Expand Down
18 changes: 14 additions & 4 deletions docs/types/sample.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,23 @@ Sample Attributes
Samples can be administered through the Django `admin site`_ or the
:ref:`command line <usage-cli>`. They have the following attributes:

:Name:
:name:
The name of the Sample.
:Percent:
:percent:
A number from 0.0 to 100.0 that determines how often the Sample
will be active.
:Note:
Describe where the Sample is used.
:note:
Describes where the Sample is used.



Sample Methods
==============

The Sample class has the following public methods:

:is_active:
Determines if the sample is active. Returns a boolean value.


.. _admin site: https://docs.djangoproject.com/en/dev/ref/contrib/admin/
Expand Down
17 changes: 13 additions & 4 deletions docs/types/switch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,26 @@ Switch Attributes
Switches can be administered through the Django `admin site`_ or the
:ref:`command line <usage-cli>`. They have the following attributes:

:Name:
:name:
The name of the Switch.
:Active:
:active:
Is the Switch active or inactive.
:Note:
Describe where the Switch is used.
:note:
Describes where the Switch is used.


.. _admin site: https://docs.djangoproject.com/en/dev/ref/contrib/admin/


Switch Methods
==============

The Switch class has the following public methods:

:is_active:
Determines if the switch is active. Returns a boolean value.


.. _types-custom-switch-models:

Custom Switch Models
Expand Down

0 comments on commit 2dd8fac

Please sign in to comment.