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.

gis.geos.fromfile()

fromfile(file_h) Parameters: file_h (a Python file object or a string path to the file) – input file that contains spatial data Return type: a GEOSGeometry corresponding to the spatial data in the file Example: >>> from django.contrib.gis.geos import fromfile >>> g = fromfile('/home/bob/geom.wkt')

http.QueryDict.urlencode()

QueryDict.urlencode(safe=None) [source] Returns a string of the data in query-string format. Example: >>> q = QueryDict('a=2&b=3&b=5') >>> q.urlencode() 'a=2&b=3&b=5' Optionally, urlencode can be passed characters which do not require encoding. For example: >>> q = QueryDict(mutable=True) >>> q['next'] = '/a&b/' >>> q.urlencode(safe='/') 'next=/a%26b/'