Reference
Paginator
Paginator.object_list : Required. A list, tuple, QuerySet, or other sliceable object with a count() or __len__() method. For consistent pagination, QuerySets should be ordered, e.g. with an order_by() clause or with a default ordering on the model. Paginator.per_page : Required.
4.2
5.0
5.1
5.2
6.0
Index
| | | | --- | --- | | - y (LineString attribute) - (Point attribute) - year - field lookup type - year (YearMixin attribute) - year_format (YearMixin attribute) - YEAR_MONTH_FORMAT - setting | - YearArchiveView (built-in class) - …
Internals
Django Deprecation Timeline
django.core.paginator.QuerySetPaginator will be removed. A model’s Meta.ordering will no longer affect GROUP BY queries. django.contrib.postgres.fields.FloatRangeField and django.contrib.postgres.forms.FloatRangeField will be removed. The FILE_CHARSET setting will be removed. django.contrib.staticfiles.storage.CachedStaticFilesStorage will be removed. RemoteUserBackend.configure_user() will require request as the first positional argument.
dev
Reference
PostgreSQL specific aggregation functions
classBitAnd(expression,filter=None,default=None,**extra) : Returns an int of the bitwise AND of all non-null input values, or default if all values are null.
dev
Reference
PostgreSQL specific aggregation functions
classBitOr(expression,filter=None,default=None,**extra) : Returns an int of the bitwise OR of all non-null input values, or default if all values are null.
dev
Reference
PostgreSQL specific aggregation functions
classBitXor(expression,filter=None,default=None,**extra) : Returns an int of the bitwise XOR of all non-null input values, or default if all values are null.
dev
Reference
PostgreSQL specific aggregation functions
classStringAgg(expression,delimiter,distinct=False,filter=None,default=None,order_by=()) : > WARNING: > > Deprecated since version 6.0: The PostgreSQL StringAgg class is deprecated in favor of the > generally available StringAgg class.
dev
Reference
Databases
These are triggered when using the iexact or contains filters in querysets. The behavior splits into two cases: For substring matching, all matches are done case-insensitively. That is a filter such as filter(name__contains="aa") will match a name of "Aabb".
dev
Reference
Conditional Expressions
What if we want to find out how many clients there are for each account_type?
dev
Reference
Model index reference
Index options
Index.condition If the table is very large and your queries mostly target a subset of rows, it may be useful to restrict an index to that subset. Specify a condition as a Q.
Topic guide
Aggregation
When using the values() clause to group query results for annotations in MySQL with the ONLY_FULL_GROUP_BY SQL mode enabled, you may need to apply AnyValue if the annotation includes a mix of aggregate and non-aggregate expressions.
dev
Internals
Django Deprecation Timeline
django.core.paginator.QuerySetPaginator will be removed. A model’s Meta.ordering will no longer affect GROUP BY queries. django.contrib.postgres.fields.FloatRangeField and django.contrib.postgres.forms.FloatRangeField will be removed. The FILE_CHARSET setting will be removed. django.contrib.staticfiles.storage.CachedStaticFilesStorage will be removed. RemoteUserBackend.configure_user() will require request as the first positional argument.
5.2
6.0
Reference
PostgreSQL specific aggregation functions
General-purpose aggregation functions
classStringAgg(expression,delimiter,distinct=False,filter=None,default=None,order_by=()) : > WARNING: > > Deprecated since version 6.0: The PostgreSQL StringAgg class is deprecated in favor of the > generally available StringAgg class.
6.0
Reference
Databases
SQLite notes
These are triggered when using the iexact or contains filters in querysets. The behavior splits into two cases: For substring matching, all matches are done case-insensitively. That is a filter such as filter(name__contains="aa") will match a name of "Aabb".
4.2
5.0
5.1
5.2
6.0
Reference
Conditional Expressions
Advanced queries
What if we want to find out how many clients there are for each account_type?
4.2
5.0
5.1
5.2
6.0
Index
| | | | --- | --- | | - W3CGeoFeed (class in django.contrib.gis.feeds) - Warning (class in django.core.checks) - warp() (GDALRaster method) - WASM_UNSAFE_EVAL (CSP attribute) - week - field lookup type - week (WeekMixin attribute) - week_day - …
Internals
Django Deprecation Timeline
Support for passing raw column aliases to QuerySet.order_by() will be removed. The model NullBooleanField will be removed. A stub field will remain for compatibility with historical migrations. django.conf.urls.url() will be removed. The model django.contrib.postgres.fields.JSONField will be removed.
5.0
5.1
5.2
6.0
Internals
Django Deprecation Timeline
The default_app_config module variable will be removed. TransactionTestCase.assertQuerysetEqual() will no longer automatically call repr() on a queryset when compared to string values. django.core.cache.backends.memcached.MemcachedCache will be removed. Support for the pre-Django 3.2 format of messages used by django.contrib.messages.storage.cookie.CookieStorage will be removed.
4.2
5.0
5.1
5.2
6.0
Internals
Django Deprecation Timeline
Support for pytz timezones will be removed. The is_dst argument will be removed from: QuerySet.datetimes() django.utils.timezone.make_aware() django.db.models.functions.Trunc() django.db.models.functions.TruncSecond() django.db.models.functions.TruncMinute() django.db.models.functions.TruncHour() django.db.models.functions.TruncDay() django.db.models.functions.TruncWeek() django.db.models.functions.TruncMonth() django.db.models.functions.TruncQuarter() django.db.models.functions.TruncYear() The django.contrib.gis.admin.GeoModelAdmin and OSMGeoAdmin classes will be removed. The undocumented BaseForm._html_output() method will be removed.
4.2
5.0
5.1
5.2
6.0
FAQ
FAQ: The admin
Using the same trick of extracting the user from the request, the get_queryset() and has_change_permission() can be used to control the visibility and editability of objects in the admin.
dev