CryptographicFields.fields module

class CryptographicFields.fields.StartsWith(lhs, rhs)[source]

Bases: django.db.models.lookups.FieldGetDbPrepValueMixin, django.db.models.lookups.StartsWith

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

Bases: django.db.models.fields.CharField

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

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.

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
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

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
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.

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
class CryptographicFields.fields.DateField(verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs)[source]

Bases: django.db.models.fields.DateField

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
pre_save(model_instance, add)[source]

Return field’s value just before saving.

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.

class_lookups = {'date': <class 'CryptographicFields.fields.StartsWith'>, 'startswith': <class 'CryptographicFields.fields.StartsWith'>}
class CryptographicFields.fields.DateTimeField(verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs)[source]

Bases: django.db.models.fields.DateTimeField

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
pre_save(model_instance, add)[source]

Return field’s value just before saving.

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.

class_lookups = {'date': <class 'CryptographicFields.fields.StartsWith'>, 'startswith': <class 'CryptographicFields.fields.StartsWith'>}
class CryptographicFields.fields.TimeField(verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs)[source]

Bases: django.db.models.fields.TimeField

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
pre_save(model_instance, add)[source]

Return field’s value just before saving.

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.

class_lookups = {'time': <class 'CryptographicFields.fields.StartsWith'>}
class CryptographicFields.fields.DecimalField(verbose_name=None, name=None, max_digits=None, decimal_places=None, **kwargs)[source]

Bases: django.db.models.fields.DecimalField

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

get_db_prep_save(value, connection)[source]

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

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
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.

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

Bases: CryptographicFields.fields.CharField

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

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

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
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

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

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.

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

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

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.

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

error_messages
description
MAX_BIGINT = 9223372036854775807
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.

formfield(**kwargs)[source]

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

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

Bases: django.db.models.fields.GenericIPAddressField

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

from_db_value(value: Any, expression: Any, connection: Any) → Any[source]
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.

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
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
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.

formfield(**kwargs)[source]

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

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
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.

formfield(**kwargs)[source]

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

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
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.

formfield(**kwargs)[source]

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

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

Bases: CryptographicFields.fields.CharField

description
default_validators = [<django.core.validators.RegexValidator object>]
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.

get_internal_type()[source]
formfield(**kwargs)[source]

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

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
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

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

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.

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
class CryptographicFields.fields.URLField(verbose_name=None, name=None, **kwargs)[source]

Bases: CryptographicFields.fields.CharField

default_validators = [<django.core.validators.URLValidator object>]
description
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.

formfield(**kwargs)[source]

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

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
class CryptographicFields.fields.BinaryField(*args, **kwargs)[source]

Bases: django.db.models.fields.BinaryField

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

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.

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
class CryptographicFields.fields.UUIDField(verbose_name=None, **kwargs)[source]

Bases: django.db.models.fields.UUIDField

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

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.

class_lookups = {'startswith': <class 'CryptographicFields.fields.StartsWith'>}
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

get_internal_type() → str[source]
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.

get_prep_value(value: Any) → Any[source]

Perform preliminary non-db specific value checks and conversions.

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().

class_lookups = {'startswith': <class 'CryptographicFields.fields.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.