Reference
The Django admin site
ModelAdmin objects
WARNING: When overriding ModelAdmin.save_model() and > ModelAdmin.delete_model(), your code must save/delete the > object. They aren’t meant for veto purposes, rather they allow you to > perform extra operations.
Reference
The Django admin site
ModelAdmin objects
ModelAdmin.get_exclude(request,obj=None) : The get_exclude method is given the HttpRequest and the obj being edited (or None on an add form) and is expected to return a list of fields, as described in ModelAdmin.exclude.
Reference
The Django admin site
ModelAdmin objects
ModelAdmin.get_inline_instances(request,obj=None)[source] : The get_inline_instances method is given the HttpRequest and the obj being edited (or None on an add form) and is expected to return a list or tuple of InlineModelAdmin objects, as described below in the InlineModelAdmin section.
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_formset_kwargs(request,obj,inline,prefix)[source] : A hook for customizing the keyword arguments passed to the constructor of a formset. For example, to pass request to formset forms: ModelAdmin.get_changeform_initial_data(request)[source] : A hook for the initial data on admin change forms.
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.
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.
Reference
The Django admin site
Overriding admin templates
After looking at change_form.html we determine that we only need to override the object-tools-items block. Therefore here is our new change_form.html : And that’s it!
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'].
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 …
Reference
GDAL API
Vector Data Source Objects
classField : name
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:
Reference
GIS QuerySet API Reference
Spatial Lookups
This lookup requires a tuple parameter, (geom, pattern); the form of pattern will depend on the spatial backend:
Reference
GIS QuerySet API Reference
Availability: PostGIS, Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Native) For an overview on performing distance queries, please refer to the distance queries introduction.
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 …
Reference
GeoDjango Tutorial
Spatial Queries
When doing spatial queries, GeoDjango automatically transforms geometries if they’re in a different coordinate system.
Reference
PostgreSQL specific model fields
Range Fields
classIntegerRangeField(**options) : Stores a range of integers. Based on an IntegerField. Represented by an int4range in the database and a django.db.backends.postgresql.psycopg_any.NumericRange in Python.
Reference
PostgreSQL specific model fields
Range Fields
classBigIntegerRangeField(**options) : Stores a range of large integers. Based on a BigIntegerField. Represented by an int8range in the database and a django.db.backends.postgresql.psycopg_any.NumericRange in Python.
Reference
PostgreSQL specific model fields
Range Fields
classDateRangeField(**options) : Stores a range of dates. Based on a DateField. Represented by a daterange in the database and a django.db.backends.postgresql.psycopg_any.DateRange in Python.
Reference
django-admin and manage.py
Available commands
--format FORMAT Specifies the serialization format (e.g., json or xml) for fixtures read from stdin. --exclude EXCLUDE, -e EXCLUDE Excludes loading the fixtures from the given applications and/or models (in the form of app_label or app_label.ModelName).