Models

PasswordChangeRequired

class password_policies.models.PasswordChangeRequired(*args, **kwargs)

Stores an entry to enforce password changes, related to auth.User.

Has the following fields:

created

DateTimeField (Automatically set when created)

The date the entry was created.

Parameters:
  • auto_now_add – True

  • blank – True

  • db_index – True

  • error_messages – {‘blank’: ‘This field cannot be blank.’, ‘invalid’: ‘“%(value)s” value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.’, ‘invalid_choice’: ‘Value %(value)r is not a valid choice.’, ‘invalid_date’: ‘“%(value)s” value has the correct format (YYYY-MM-DD) but it is an invalid date.’, ‘invalid_datetime’: ‘“%(value)s” value has the correct format (YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ]) but it is an invalid date/time.’, ‘null’: ‘This field cannot be null.’, ‘unique’: ‘%(model_name)s with this %(field_label)s already exists.’, ‘unique_for_date’: ‘%(field_label)s must be unique for %(date_field_label)s %(lookup_type)s.’}

  • help_text – The date the entry was created.

  • verbose_name – created

user

OneToOneField(’User’) (Required)

The user who needs to change his/her password.

Parameters:
  • db_index – True

  • error_messages – {‘blank’: ‘This field cannot be blank.’, ‘invalid’: ‘%(model)s instance with %(field)s %(value)r is not a valid choice.’, ‘invalid_choice’: ‘Value %(value)r is not a valid choice.’, ‘null’: ‘This field cannot be null.’, ‘unique’: ‘%(model_name)s with this %(field_label)s already exists.’, ‘unique_for_date’: ‘%(field_label)s must be unique for %(date_field_label)s %(lookup_type)s.’}

  • help_text – The user who needs to change his/her password.

  • unique – True

  • verbose_name – user

Meta

get_latest_by = created

ordering = [‘-created’]

unique_together = ()

verbose_name = enforced password change

verbose_name_plural = enforced password changes

exception DoesNotExist
exception MultipleObjectsReturned
exception NotUpdated

PasswordHistory

class password_policies.models.PasswordHistory(*args, **kwargs)

Stores a single password history entry, related to auth.User.

Has the following fields:

created

DateTimeField (Automatically set when created)

The date the entry was created.

Parameters:
  • auto_now_add – True

  • blank – True

  • db_index – True

  • error_messages – {‘blank’: ‘This field cannot be blank.’, ‘invalid’: ‘“%(value)s” value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.’, ‘invalid_choice’: ‘Value %(value)r is not a valid choice.’, ‘invalid_date’: ‘“%(value)s” value has the correct format (YYYY-MM-DD) but it is an invalid date.’, ‘invalid_datetime’: ‘“%(value)s” value has the correct format (YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ]) but it is an invalid date/time.’, ‘null’: ‘This field cannot be null.’, ‘unique’: ‘%(model_name)s with this %(field_label)s already exists.’, ‘unique_for_date’: ‘%(field_label)s must be unique for %(date_field_label)s %(lookup_type)s.’}

  • help_text – The date the entry was created.

  • verbose_name – created

password

CharField (Required)

The encrypted password.

Parameters:
  • error_messages – {‘blank’: ‘This field cannot be blank.’, ‘invalid_choice’: ‘Value %(value)r is not a valid choice.’, ‘null’: ‘This field cannot be null.’, ‘unique’: ‘%(model_name)s with this %(field_label)s already exists.’, ‘unique_for_date’: ‘%(field_label)s must be unique for %(date_field_label)s %(lookup_type)s.’}

  • help_text – The encrypted password.

  • max_length – 128

  • validators – [’MaxLengthValidator’]

  • verbose_name – password

user

ForeignKey(’User’) (Required)

The user this password history entry belongs to.

Parameters:
  • db_index – True

  • error_messages – {‘blank’: ‘This field cannot be blank.’, ‘invalid’: ‘%(model)s instance with %(field)s %(value)r is not a valid choice.’, ‘invalid_choice’: ‘Value %(value)r is not a valid choice.’, ‘null’: ‘This field cannot be null.’, ‘unique’: ‘%(model_name)s with this %(field_label)s already exists.’, ‘unique_for_date’: ‘%(field_label)s must be unique for %(date_field_label)s %(lookup_type)s.’}

  • help_text – The user this password history entry belongs to.

  • verbose_name – user

Meta

get_latest_by = created

ordering = [‘-created’]

unique_together = ()

verbose_name = password history entry

verbose_name_plural = password history entries

exception DoesNotExist
exception MultipleObjectsReturned
exception NotUpdated