CryptographicFields.fields module

class CryptographicFields.fields.BigIntegerField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: CryptographicFields.fields.IntegerField

MAX_BIGINT = 9223372036854775807
description
error_messages
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.BinaryField(*args, **kwargs)[source]

Bases: django.db.models.fields.BinaryField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.BooleanField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: django.db.models.fields.BooleanField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.CharField(*args, **kwargs)[source]

Bases: django.db.models.fields.CharField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.DateField(verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs)[source]

Bases: django.db.models.fields.DateField

class_lookups = {'date': <class 'CryptographicFields.utils.StartsWith'>, 'startswith': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

pre_save(model_instance, add)[source]

Return field’s value just before saving.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.DateTimeField(verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs)[source]

Bases: django.db.models.fields.DateTimeField

class_lookups = {'date': <class 'CryptographicFields.utils.StartsWith'>, 'startswith': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

pre_save(model_instance, add)[source]

Return field’s value just before saving.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.DecimalField(verbose_name=None, name=None, max_digits=None, decimal_places=None, **kwargs)[source]

Bases: django.db.models.fields.DecimalField

clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_save(value, connection)[source]

Return field’s value prepared for saving into a database.

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.EmailField(*args, **kwargs)[source]

Bases: CryptographicFields.fields.CharField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
default_validators = [<django.core.validators.EmailValidator object>]
description
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class CryptographicFields.fields.FilePathField(verbose_name=None, name=None, path='', match=None, recursive=False, allow_files=True, allow_folders=False, **kwargs)[source]

Bases: django.db.models.fields.FilePathField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.FloatField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: django.db.models.fields.FloatField

clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.GenericIPAddressField(verbose_name=None, name=None, protocol='both', unpack_ipv4=False, *args, **kwargs)[source]

Bases: django.db.models.fields.GenericIPAddressField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.IntegerField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: django.db.models.fields.IntegerField

clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.PositiveBigIntegerField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: django.db.models.fields.PositiveIntegerRelDbTypeMixin, CryptographicFields.fields.IntegerField

description
error_messages
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.PositiveIntegerField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: django.db.models.fields.PositiveIntegerRelDbTypeMixin, CryptographicFields.fields.IntegerField

description
error_messages
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.PositiveSmallIntegerField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: django.db.models.fields.PositiveIntegerRelDbTypeMixin, CryptographicFields.fields.IntegerField

description
error_messages
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.SlugField(*args, max_length=50, db_index=True, allow_unicode=False, **kwargs)[source]

Bases: CryptographicFields.fields.CharField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.

  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.

  • A list of positional arguments.

  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict

  • UUID

  • datetime.datetime (naive), datetime.date

  • top-level classes, top-level functions - will be referenced by their full import path

  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

default_validators = [<django.core.validators.RegexValidator object>]
description
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

get_internal_type()[source]
class CryptographicFields.fields.SmallIntegerField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: CryptographicFields.fields.IntegerField

description
class CryptographicFields.fields.TextField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Bases: django.db.models.fields.TextField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.TimeField(verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs)[source]

Bases: django.db.models.fields.TimeField

class_lookups = {'time': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

pre_save(model_instance, add)[source]

Return field’s value just before saving.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class CryptographicFields.fields.URLField(verbose_name=None, name=None, **kwargs)[source]

Bases: CryptographicFields.fields.CharField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.

  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.

  • A list of positional arguments.

  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict

  • UUID

  • datetime.datetime (naive), datetime.date

  • top-level classes, top-level functions - will be referenced by their full import path

  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

default_validators = [<django.core.validators.URLValidator object>]
description
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class CryptographicFields.fields.UUIDField(verbose_name=None, **kwargs)[source]

Bases: django.db.models.fields.UUIDField

class_lookups = {'startswith': <class 'CryptographicFields.utils.StartsWith'>}
clean(value, model_instance)[source]

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
get_db_prep_value(value, connection, prepared=False)[source]

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_internal_type() → str[source]
get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

to_python(value: Any) → Any[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.