Reference Generic date views
classWeekArchiveView[source] : A weekly archive page showing all objects in a given week. Objects with a date in the future are not displayed unless you set allow_future to True.
743 sections in Django 6.0 Search all versions →
Reference Generic date views
classWeekArchiveView[source] : A weekly archive page showing all objects in a given week. Objects with a date in the future are not displayed unless you set allow_future to True.
Reference Generic date views
classDayArchiveView[source] : A day archive page showing all objects in a given day. Days in the future throw a 404 error, regardless of whether any objects exist for future days, unless you set allow_future to True.
Reference Date-based mixins
classBaseDateListView[source] : A base class that provides common behavior for all date-based views. There won’t normally be a reason to instantiate BaseDateListView; instantiate one of the subclasses instead.
Reference Multiple object mixins
classdjango.views.generic.list.MultipleObjectMixin : A mixin that can be used to display a list of objects.
Reference The Django admin site ModelAdmin objects
The ModelAdmin is very flexible. It has several options for dealing with customizing the interface. All options are defined on the ModelAdmin subclass: ModelAdmin.actions : A list of actions to make available on the change list page.
Reference The Django admin site ModelAdmin objects
Call super().delete_model() to delete the object using Model.delete(). ModelAdmin.delete_queryset(request,queryset)[source] : The delete_queryset() method is given the HttpRequest and a QuerySet of objects to be deleted. Override this method to customize the deletion process for the “delete selected objects” action.
Reference The Django admin site ModelAdmin objects
ModelAdmin.get_form(request,obj=None,**kwargs)[source] : Returns a ModelForm class for use in the admin add and change views, see add_view() and change_view(). ModelAdmin.get_formsets_with_inlines(request,obj=None)[source] : Yields (FormSet, InlineModelAdmin) pairs for use in admin add and change views.
Reference The Django admin site ModelAdmin objects
ModelAdmin.get_queryset(request) : The get_queryset method on a ModelAdmin returns a QuerySet of all model instances that can be edited by the admin site.
Reference The Django admin site ModelAdmin objects
ModelAdmin.response_delete(request,obj_display,obj_id)[source] : Determines the HttpResponse for the delete_view() stage. ModelAdmin.get_formset_kwargs(request,obj,inline,prefix)[source] : A hook for customizing the keyword arguments passed to the constructor of a formset.
Reference django.contrib.auth User model
classmodels.UserManager : The User model has a custom manager that has the following helper methods (in addition to the methods provided by BaseUserManager):
Reference django.contrib.auth Authentication backends
The following backends are available in django.contrib.auth.backends: classBaseBackend[source] : A base class that provides default implementations for all required methods. By default, it will reject any user and provide no permissions.
Reference Geographic Database Functions Measurements
… more resource-intensive). In the following example, the distance from the city of Hobart to every other PointField in the AustraliaCity queryset is calculated: NOTE: Because the distance attribute is a > Distance object, you can easily > express the value …
Reference
… with Raster Fields Spatial Lookups Distance Queries Compatibility Tables GeoDjango Forms API Field arguments Form field classes Form widgets GIS QuerySet API Reference Spatial Lookups Distance Lookups Geographic Database Functions Measurements Relationships Operations Editors Input format Output format Miscellaneous Measurement …
Reference GeoDjango Tutorial Spatial Queries
When doing spatial queries, GeoDjango automatically transforms geometries if they’re in a different coordinate system.
Reference Databases PostgreSQL notesServer-side cursors
Another option is to wrap each QuerySet using server-side cursors in an atomic() block, because it disables autocommit for the duration of the transaction. This way, the server-side cursor will only live for the duration of the transaction.
Reference Database Functions Date functions
classExtract(expression,lookup_name=None,tzinfo=None,**extra)[source] Extracts a component of a date as a number. Takes an expression representing a DateField, DateTimeField, TimeField, or DurationField and a lookup_name, and returns the part of the date referenced by lookup_name as an IntegerField.
Reference Query Expressions Built-in Expressions
As well as being used in operations on single instances as above, F() can be used with update() to perform bulk updates on a QuerySet.
Reference Query Expressions Technical Information
As an example, an expression implementing `NULLS LAST` would change its value to be `NULLS FIRST`. Modifications are only required for expressions that implement sort order like `OrderBy`. This method is called when [`reverse()`](querysets.md#django.db.models.query.QuerySet.reverse) is called on a queryset.
Reference Model field reference Relationship fieldsManyToManyField
ForeignKey.limit_choices_to : Sets a limit to the available choices for this field when this field is rendered using a ModelForm or the admin (by default, all objects in the queryset are available to choose).
Reference Model Meta options Available Meta options
Options.ordering : The default ordering for the object, for use when obtaining lists of objects: NOTE: In GROUP BY queries (for example, > those using values() and annotate()), the > default ordering is not applied.