auth.models.PermissionsMixin

class models.PermissionsMixin is_superuser Boolean. Designates that this user has all permissions without explicitly assigning them. get_group_permissions(obj=None) Returns a set of permission strings that the user has, through their groups. If obj is passed in, only returns the group permissions for this specific object. get_all_permissions(obj=None) Returns a set of permission strings that the user has, both through group and user permissions. If obj is passed in, only retur

auth.password_validation.get_password_validators()

get_password_validators(validator_config) [source] Returns a set of validator objects based on the validator_config parameter. By default, all functions use the validators defined in AUTH_PASSWORD_VALIDATORS, but by calling this function with an alternate set of validators and then passing the result into the password_validators parameter of the other functions, your custom set of validators will be used instead. This is useful when you have a typical set of validators to use for most scenar

auth.password_validation.UserAttributeSimilarityValidator

class UserAttributeSimilarityValidator(user_attributes=DEFAULT_USER_ATTRIBUTES, max_similarity=0.7) [source] Validates whether the password is sufficiently different from certain attributes of the user. The user_attributes parameter should be an iterable of names of user attributes to compare to. If this argument is not provided, the default is used: 'username', 'first_name', 'last_name', 'email'. Attributes that don’t exist are ignored. The maximum similarity the password can have, before i

auth.password_validation.validate_password()

validate_password(password, user=None, password_validators=None) [source] Validates a password. If all validators find the password valid, returns None. If one or more validators reject the password, raises a ValidationError with all the error messages from the validators. The user object is optional: if it’s not provided, some validators may not be able to perform any validation and will accept any password.

auth.views.password_reset_confirm()

password_reset_confirm(request, uidb64=None, token=None, template_name='registration/password_reset_confirm.html', token_generator=default_token_generator, set_password_form=SetPasswordForm, post_reset_redirect=None, current_app=None, extra_context=None) Presents a form for entering a new password. URL name: password_reset_confirm Optional arguments: uidb64: The user’s id encoded in base 64. Defaults to None. token: Token to check that the password is valid. Defaults to None. template_nam

db.models.expressions.When

class When(condition=None, then=None, **lookups) [source] A When() object is used to encapsulate a condition and its result for use in the conditional expression. Using a When() object is similar to using the filter() method. The condition can be specified using field lookups or Q objects. The result is provided using the then keyword. Some examples: >>> from django.db.models import When, F, Q >>> # String arguments refer to fields; the following two examples are equivalent

db.models.Field.get_internal_type()

get_internal_type() [source] Returns a string naming this field for backend specific purposes. By default, it returns the class name. See Emulating built-in field types for usage in custom fields.

db.models.ForeignKey.related_query_name

ForeignKey.related_query_name The name to use for the reverse filter name from the target model. It defaults to the value of related_name or default_related_name if set, otherwise it defaults to the name of the model: # Declare the ForeignKey with related_query_name class Tag(models.Model): article = models.ForeignKey( Article, on_delete=models.CASCADE, related_name="tags", related_query_name="tag", ) name = models.CharField(max_length=255) # That

db.models.functions.datetime.TruncHour

class TruncHour(expression, output_field=None, tzinfo=None, **extra) [source] kind = 'hour'

gis.geoip.GeoIP.geos()

GeoIP.geos(query) Returns a django.contrib.gis.geos.Point object corresponding to the query.