gis.db.models.functions.Distance

class Distance(expr1, expr2, spheroid=None, **extra) Availability: MySQL (≥ 5.6.1), PostGIS, Oracle, SpatiaLite Accepts two geographic fields or expressions and returns the distance between them, as a Distance object. On MySQL, a raw float value is returned, as it’s not possible to automatically determine the unit of the field. On backends that support distance calculation on geodetic coordinates, the proper backend function is automatically chosen depending on the SRID value of the geometri

http.JsonResponse

class JsonResponse(data, encoder=DjangoJSONEncoder, safe=True, json_dumps_params=None, **kwargs) [source] An HttpResponse subclass that helps to create a JSON-encoded response. It inherits most behavior from its superclass with a couple differences: Its default Content-Type header is set to application/json. The first parameter, data, should be a dict instance. If the safe parameter is set to False (see below) it can be any JSON-serializable object. The encoder, which defaults to django.core

gis.admin.GeoModelAdmin

class GeoModelAdmin default_lon The default center longitude. default_lat The default center latitude. default_zoom The default zoom level to use. Defaults to 18. extra_js Sequence of URLs to any extra JavaScript to include. map_template Override the template used to generate the JavaScript slippy map. Default is 'gis/admin/openlayers.html'. map_width Width of the map, in pixels. Defaults to 600. map_height Height of the map, in pixels. Defaults to 400. op

admin.ModelAdmin.get_queryset()

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. One use case for overriding this method is to show objects owned by the logged-in user: class MyModelAdmin(admin.ModelAdmin): def get_queryset(self, request): qs = super(MyModelAdmin, self).get_queryset(request) if request.user.is_superuser: return qs return qs.filter(author=request.user)

forms.TypedMultipleChoiceField

class TypedMultipleChoiceField(**kwargs) [source] Just like a MultipleChoiceField, except TypedMultipleChoiceField takes two extra arguments, coerce and empty_value. Default widget: SelectMultiple Empty value: Whatever you’ve given as empty_value Normalizes to: A list of values of the type provided by the coerce argument. Validates that the given values exists in the list of choices and can be coerced. Error message keys: required, invalid_choice The invalid_choice error message may con

gis.admin.GeoModelAdmin.default_lon

default_lon The default center longitude.

forms.Field.help_text

Field.help_text The help_text argument lets you specify descriptive text for this Field. If you provide help_text, it will be displayed next to the Field when the Field is rendered by one of the convenience Form methods (e.g., as_ul()). Like the model field’s help_text, this value isn’t HTML-escaped in automatically-generated forms. Here’s a full example Form that implements help_text for two of its fields. We’ve specified auto_id=False to simplify the output: >>> from django import

db.models.functions.datetime.TruncHour

class TruncHour(expression, output_field=None, tzinfo=None, **extra) [source] kind = 'hour'

db.models.Expression.resolve_expression()

resolve_expression(query=None, allow_joins=True, reuse=None, summarize=False, for_save=False) Provides the chance to do any pre-processing or validation of the expression before it’s added to the query. resolve_expression() must also be called on any nested expressions. A copy() of self should be returned with any necessary transformations. query is the backend query implementation. allow_joins is a boolean that allows or denies the use of joins in the query. reuse is a set of reusable joins

admin.ModelAdmin.get_changelist()

ModelAdmin.get_changelist(request, **kwargs) [source] Returns the Changelist class to be used for listing. By default, django.contrib.admin.views.main.ChangeList is used. By inheriting this class you can change the behavior of the listing.