cri_models.fields module

class cri_models.fields.GraduationYearField(*args, **kwargs)[source]

Bases: django.db.models.fields.PositiveIntegerField

class cri_models.fields.SSHPubKey(keydata=None, **kwargs)[source]

Bases: sshpubkeys.keys.SSHKey

classmethod clean(value, disallow_options=False)[source]
property key_without_comment
class cri_models.fields.SSHPublicKeyField(*args, **kwargs)[source]

Bases: django.db.models.fields.TextField

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.

from_db_value(value, _expression, _connection)[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_prep_value(value)[source]

Perform preliminary non-db specific value checks and conversions.

sshpubkey_validator(value)[source]
to_python(value)[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 cri_models.fields.UnixIDField(*args, **kwargs)[source]

Bases: django.db.models.fields.PositiveIntegerField