oauth2client.contrib.django_util.models module

Contains classes used for the Django ORM storage.

class oauth2client.contrib.django_util.models.CredentialsField(*args, **kwargs)[source]

Bases: django.db.models.fields.Field

Django ORM field for storing OAuth2 Credentials.

from_db_value(value, expression, connection, context)[source]

Overrides models.Field method. This converts the value returned from the database to an instance of this class.

get_internal_type()[source]
get_prep_value(value)[source]

Overrides models.Field method. This is used to convert the value from an instances of this class to bytes that can be inserted into the database.

to_python(value)[source]

Overrides models.Field method. This is used to convert bytes (from serialization etc) to an instance of this class

value_to_string(obj)[source]

Convert the field value from the provided model to a string.

Used during model serialization.

Parameters:obj – db.Model, model object
Returns:string, the serialized field value