auth.backends.AllowAllUsersModelBackend

class AllowAllUsersModelBackend New in Django 1.10. Same as ModelBackend except that it doesn’t reject inactive users because user_can_authenticate() always returns True. When using this backend, you’ll likely want to customize the AuthenticationForm used by the login() view by overriding the confirm_login_allowed() method as it rejects inactive users.

views.defaults.permission_denied()

defaults.permission_denied(request, exception, template_name='403.html') In the same vein as the 404 and 500 views, Django has a view to handle 403 Forbidden errors. If a view results in a 403 exception then Django will, by default, call the view django.views.defaults.permission_denied. This view loads and renders the template 403.html in your root template directory, or if this file does not exist, instead serves the text “403 Forbidden”, as per RFC 7231#section-6.5.3 (the HTTP 1.1 Specific

forms.TypedMultipleChoiceField

class TypedMultipleChoiceField(**kwargs) [source] Just like a MultipleChoiceField, except TypedMultipleChoiceField takes two extra arguments, coerce and empty_value. Default widget: SelectMultiple Empty value: Whatever you’ve given as empty_value Normalizes to: A list of values of the type provided by the coerce argument. Validates that the given values exists in the list of choices and can be coerced. Error message keys: required, invalid_choice The invalid_choice error message may con

admin.AdminSite.site_url

AdminSite.site_url The URL for the “View site” link at the top of each admin page. By default, site_url is /. Set it to None to remove the link. For sites running on a subpath, the each_context() method checks if the current request has request.META['SCRIPT_NAME'] set and uses that value if site_url isn’t set to something other than /. Changed in Django 1.10: The SCRIPT_NAME support described in the previous paragraph was added.

utils.timezone.override()

override(timezone) [source] This is a Python context manager that sets the current time zone on entry with activate(), and restores the previously active time zone on exit. If the timezone argument is None, the current time zone is unset on entry with deactivate() instead. override is also usable as a function decorator.

postgres.fields.HStoreField

class HStoreField(**options) [source] A field for storing mappings of strings to strings. The Python data type used is a dict. To use this field, you’ll need to: Add 'django.contrib.postgres' in your INSTALLED_APPS. Setup the hstore extension in PostgreSQL before the first CreateModel or AddField operation by adding a migration with the HStoreExtension operation. For example: from django.contrib.postgres.operations import HStoreExtension class Migration(migrations.Migration): ...

db.models.functions.datetime.TruncSecond

class TruncSecond(expression, output_field=None, tzinfo=None, **extra) [source] kind = 'second' These are logically equivalent to Trunc('datetime_field', kind). They truncate all parts of the date up to kind and allow grouping or filtering datetimes with less precision. expression must have an output_field of DateTimeField. Usage example: >>> from datetime import date, datetime >>> from django.db.models import Count >>> from django.db.models.functions import (

db.models.StdDev

class StdDev(expression, sample=False, **extra) [source] Returns the standard deviation of the data in the provided expression. Default alias: <field>__stddev Return type: float Has one optional argument: sample By default, StdDev returns the population standard deviation. However, if sample=True, the return value will be the sample standard deviation. SQLite SQLite doesn’t provide StdDev out of the box. An implementation is available as an extension module for SQLite. Consu

views.generic.list.MultipleObjectTemplateResponseMixin.get_template_names()

get_template_names() Returns a list of candidate template names. Returns the following list: the value of template_name on the view (if provided) <app_label>/<model_name><template_name_suffix>.html

postgres.fields.DateRangeField

class DateRangeField(**options) [source] Stores a range of dates. Based on a DateField. Represented by a daterange in the database and a DateRange in Python. Regardless of the bounds specified when saving the data, PostgreSQL always returns a range in a canonical form that includes the lower bound and excludes the upper bound; that is [).