Reference GeoDjango Tutorial Spatial Queries
When doing spatial queries, GeoDjango automatically transforms geometries if they’re in a different coordinate system.
669 sections in Django 5.1 Search all versions →
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).
Reference The Forms API More granular output
BoundField.initial[source] : Use BoundField.initial to retrieve initial data for a form field. It retrieves the data from Form.initial if present, otherwise trying Field.initial. Callable values are evaluated. See Initial form values for more examples.
Reference Widgets
In the following example, the years attribute is set for a SelectDateWidget: See the Built-in widgets for more information about which widgets are available and which arguments they accept.
Reference Widgets Customizing widget instances
In a nutshell, you will need to subclass the widget and either define a “Media” inner class or create a “media” property. These methods involve somewhat advanced Python programming and are described in detail in the Form Assets topic guide.
Reference Widgets Built-in widgetsSelector and checkbox widgets
classRadioSelect[source] : - template_name: 'django/forms/widgets/radio.html' - option_template_name: 'django/forms/widgets/radio_option.html'
Reference
There are a number of built-in expressions (documented below) that can be used to help you write queries. Expressions can be combined, or in some cases nested, to form more complex computations.
Reference Model field reference Field types
Takes the same extra arguments as DateField. The default form widget for this field is a single DateTimeInput. The admin uses two separate TextInput widgets with JavaScript shortcuts. WARNING: Always use DateTimeField with a datetime.datetime > instance.
Reference Model field reference Field types
classGenericIPAddressField(protocol='both',unpack_ipv4=False,**options)[source] An IPv4 or IPv6 address, in string format (e.g. 192.0.2.30 or 2a02:42fe::4). The default form widget for this field is a TextInput.
Reference Model field reference Field types
As with other fields, you can change the maximum length using the max_length argument. The default form widget for this field is a ClearableFileInput.
Reference Model field reference Relationship fieldsManyToManyField
ForeignKey.related_name : The name to use for the relation from the related object back to this one. It’s also the default value for related_query_name (the name to use for the reverse filter name from the target model).
Reference QuerySet API reference QuerySet APIMethods that return new QuerySets
This means that for a large QuerySet a large ‘IN’ clause could be generated, which, depending on the database, might have performance problems of its own when it comes to parsing or executing the SQL query.
Reference Request and response objects StreamingHttpResponse objects
HttpRequest.body[source] : The raw HTTP request body as a bytestring. This is useful for processing data in different ways than conventional HTML forms: binary images, XML payload etc. For processing conventional form data, use HttpRequest.POST.
Reference Request and response objects StreamingHttpResponse objects
HttpRequest.COOKIES : A dictionary containing all cookies. Keys and values are strings. HttpRequest.FILES : A dictionary-like object containing all uploaded files. Each key in FILES is the name from the <input type="file" name="">. Each value in FILES is an UploadedFile.
Reference Request and response objects FileResponse objects
HttpRequest.get_full_path_info()[source] : Like get_full_path(), but uses path_info instead of path. HttpRequest.build_absolute_uri(location=None)[source] : Returns the absolute URI form of location. If no location is provided, the location will be set to request.get_full_path().
Reference Request and response objects FileResponse objects
HttpRequest.read(size=None)[source] HttpRequest.readline()[source] HttpRequest.readlines()[source] HttpRequest.__iter__()[source] : Methods implementing a file-like interface for reading from an HttpRequest instance. This makes it possible to consume an incoming request in a streaming fashion.
Reference Request and response objects
This is necessary because some HTML form elements, notably <select multiple>, pass multiple values for the same key. The QueryDicts at request.POST and request.GET will be immutable when accessed in a normal request/response cycle.