djblets.webapi.models¶
-
class
BaseWebAPIToken
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Base class for an access token used for authenticating with the API.
Each token can be used to authenticate the token’s owner with the API, without requiring a username or password to be provided. Tokens can be revoked, and new tokens added.
Tokens can store policy information, which will later be used for restricting access to the API.
-
user
[source]¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
token
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
time_added
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
last_updated
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
note
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
policy
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
extra_data
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
save
(*args, **kwargs)[source]¶ Save the token.
If the token is being updated, the
webapi_token_updated
signal will be emitted.Parameters:
-
classmethod
validate_policy
(policy)[source]¶ Validate an API policy.
This will check to ensure that the policy is in a suitable format and contains the information required in a format that can be parsed.
If a failure is found, a ValidationError will be raised describing the error and where it was found.
-