djangodocs.org

1305 sections across all versions Narrow to Django 6.0 (current) →

Application registry

Reference Applications

app_name is the full name of the app, e.g. 'django.contrib.admin'. apps.get_model(app_label,model_name,require_ready=True) : Returns the Model with the given app_label and model_name. As a shortcut, this method also accepts a single argument in the form app_label.model_name. model_name is case-insensitive.

4.2 5.0 5.1 5.2 6.0

CreateView

Reference Class-based generic views - flattened index Editing views

classCreateView Attributes (with optional accessor): content_type context_object_name [get_context_object_name()] extra_context fields form_class [get_form_class()] http_method_names initial [get_initial()] model pk_url_kwarg prefix [get_prefix()] query_pk_and_slug queryset [get_queryset()] response_class [render_to_response()] slug_field [get_slug_field()] slug_url_kwarg success_url [get_success_url()] template_engine template_name [get_template_names()] template_name_field template_name_suffix Methods as_view() dispatch() form_invalid() form_valid() get() …

4.2 5.0 5.1 5.2 6.0

UpdateView

Reference Class-based generic views - flattened index Editing views

classUpdateView Attributes (with optional accessor): content_type context_object_name [get_context_object_name()] extra_context fields form_class [get_form_class()] http_method_names initial [get_initial()] model pk_url_kwarg prefix [get_prefix()] query_pk_and_slug queryset [get_queryset()] response_class [render_to_response()] slug_field [get_slug_field()] slug_url_kwarg success_url [get_success_url()] template_engine template_name [get_template_names()] template_name_field template_name_suffix Methods as_view() dispatch() form_invalid() form_valid() get() …

4.2 5.0 5.1 5.2 6.0

Generic editing views

Reference

The following views are described on this page and provide a foundation for editing content: django.views.generic.edit.FormView django.views.generic.edit.CreateView django.views.generic.edit.UpdateView django.views.generic.edit.DeleteView NOTE: The messages framework contains > SuccessMessageMixin, which > facilitates presenting messages about successful form submissions.

4.2 5.0 5.1 5.2 6.0

DeleteView

Reference Generic editing views

If this view is fetched via GET, it will display a confirmation page that should contain a form that POSTs to the same URL. classdjango.views.generic.edit.BaseDeleteView : A base view for deleting an object instance.

4.2 5.0 5.1 5.2 6.0

Reference The Django admin site ModelAdmin objects

This can be accomplished by using a Media inner class on your ModelAdmin: The staticfiles app prepends STATIC_URL (or MEDIA_URL if STATIC_URL is None) to any asset paths. The same rules apply as regular asset definitions on forms.

4.2 5.0 5.1 5.2 6.0

jQuery

Reference The Django admin site ModelAdmin objectsModelAdmin asset definitions

Also, your own admin forms or widgets depending on django.jQuery must specify js=['admin/js/jquery.init.js', …] when declaring form media assets.

4.2 5.0 5.1 5.2 6.0

Reference django.contrib.auth Authentication backends

classAllowAllUsersModelBackend[source] : Same as ModelBackend except that it doesn’t reject inactive users because user_can_authenticate() always returns True. classRemoteUserBackend[source] : Use this backend to take advantage of external-to-Django-handled authentication. It authenticates using usernames passed in request.META['REMOTE_USER'].

4.2 5.0 5.1 5.2 6.0

Raster Lookups

Reference GeoDjango Database API Spatial Lookups

… right hand side, a tuple of the raster and band index can be specified. This results in the following general form for lookups involving rasters (assuming the Elevation model used in the GeoDjango Model API): For example: On the left …

4.2 5.0 5.1 5.2 6.0

OGRGeomType

Reference GDAL API OGR Geometries

classOGRGeomType(type_input)[source] : This class allows for the representation of an OGR geometry type in any of several ways:

4.2 5.0 5.1 5.2 6.0

GeoDjango

Reference

… Data Geographic Models Importing Spatial Data Spatial Queries Putting your data on the map GeoDjango Installation Overview Requirements Installation Troubleshooting Platform-specific instructions GeoDjango Model API Spatial Field Types Spatial Field Options Geometry Field Options GeoDjango Database API Spatial Backends Creating …

4.2 5.0 5.1 5.2 6.0