doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
class LinearRing(*args, **kwargs) LinearRing objects are constructed in the exact same way as LineString objects, however the coordinates must be closed, in other words, the first coordinates must be the same as the last coordinates. For example: >>> ls = LinearRing((0, 0), (0, 1), (1, 1), (0, 0)) Notice that (0, 0)...
django.ref.contrib.gis.geos#django.contrib.gis.geos.LinearRing
is_counterclockwise Returns whether this LinearRing is counterclockwise.
django.ref.contrib.gis.geos#django.contrib.gis.geos.LinearRing.is_counterclockwise
class LineString(*args, **kwargs) LineString objects are instantiated using arguments that are either a sequence of coordinates or Point objects. For example, the following are equivalent: >>> ls = LineString((0, 0), (1, 1)) >>> ls = LineString(Point(0, 0), Point(1, 1)) In addition, LineString objects may also be cr...
django.ref.contrib.gis.geos#django.contrib.gis.geos.LineString
closed Returns whether or not this LineString is closed.
django.ref.contrib.gis.geos#django.contrib.gis.geos.LineString.closed
class MultiLineString(*args, **kwargs) MultiLineString objects may be instantiated by passing in LineString objects as arguments, or a single sequence of LineString objects: >>> ls1 = LineString((0, 0), (1, 1)) >>> ls2 = LineString((2, 2), (3, 3)) >>> mls = MultiLineString(ls1, ls2) >>> mls = MultiLineString([ls1, ls...
django.ref.contrib.gis.geos#django.contrib.gis.geos.MultiLineString
closed Returns True if and only if all elements are closed.
django.ref.contrib.gis.geos#django.contrib.gis.geos.MultiLineString.closed
merged Returns a LineString representing the line merge of all the components in this MultiLineString.
django.ref.contrib.gis.geos#django.contrib.gis.geos.MultiLineString.merged
class MultiPoint(*args, **kwargs) MultiPoint objects may be instantiated by passing in Point objects as arguments, or a single sequence of Point objects: >>> mp = MultiPoint(Point(0, 0), Point(1, 1)) >>> mp = MultiPoint( (Point(0, 0), Point(1, 1)) )
django.ref.contrib.gis.geos#django.contrib.gis.geos.MultiPoint
class MultiPolygon(*args, **kwargs) MultiPolygon objects may be instantiated by passing Polygon objects as arguments, or a single sequence of Polygon objects: >>> p1 = Polygon( ((0, 0), (0, 1), (1, 1), (0, 0)) ) >>> p2 = Polygon( ((1, 1), (1, 2), (2, 2), (1, 1)) ) >>> mp = MultiPolygon(p1, p2) >>> mp = MultiPolygon([...
django.ref.contrib.gis.geos#django.contrib.gis.geos.MultiPolygon
class Point(x=None, y=None, z=None, srid=None) Point objects are instantiated using arguments that represent the component coordinates of the point or with a single sequence coordinates. For example, the following are equivalent: >>> pnt = Point(5, 23) >>> pnt = Point([5, 23]) Empty Point objects may be instantiated...
django.ref.contrib.gis.geos#django.contrib.gis.geos.Point
class Polygon(*args, **kwargs) Polygon objects may be instantiated by passing in parameters that represent the rings of the polygon. The parameters must either be LinearRing instances, or a sequence that may be used to construct a LinearRing: >>> ext_coords = ((0, 0), (0, 1), (1, 1), (1, 0), (0, 0)) >>> int_coords = ...
django.ref.contrib.gis.geos#django.contrib.gis.geos.Polygon
num_interior_rings Returns the number of interior rings in this geometry.
django.ref.contrib.gis.geos#django.contrib.gis.geos.Polygon.num_interior_rings
class PreparedGeometry All methods on PreparedGeometry take an other argument, which must be a GEOSGeometry instance. contains(other) contains_properly(other) covers(other) crosses(other) disjoint(other) intersects(other) overlaps(other) touches(other) within(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry
contains(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.contains
contains_properly(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.contains_properly
covers(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.covers
crosses(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.crosses
disjoint(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.disjoint
intersects(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.intersects
overlaps(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.overlaps
touches(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.touches
within(other)
django.ref.contrib.gis.geos#django.contrib.gis.geos.PreparedGeometry.within
class WKBReader Example: >>> from django.contrib.gis.geos import WKBReader >>> wkb_r = WKBReader() >>> wkb_r.read('0101000000000000000000F03F000000000000F03F') <Point object at 0x103a88910>
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKBReader
class WKBWriter(dim=2) WKBWriter provides the most control over its output. By default it returns OGC-compliant WKB when its write method is called. However, it has properties that allow for the creation of EWKB, a superset of the WKB standard that includes additional information. See the WKBWriter.outdim documentati...
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKBWriter
byteorder
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKBWriter.byteorder
outdim
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKBWriter.outdim
srid
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKBWriter.srid
write(geom)
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKBWriter.write
write_hex(geom)
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKBWriter.write_hex
class WKTReader Example: >>> from django.contrib.gis.geos import WKTReader >>> wkt_r = WKTReader() >>> wkt_r.read('POINT(1 1)') <Point object at 0x103a88b50>
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKTReader
class WKTWriter(dim=2, trim=False, precision=None) This class allows outputting the WKT representation of a geometry. See the WKBWriter.outdim, trim, and precision attributes for details about the constructor arguments. write(geom) Returns the WKT of the given geometry. Example: >>> from django.contrib.gis.geos i...
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKTWriter
outdim See WKBWriter.outdim.
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKTWriter.outdim
precision
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKTWriter.precision
trim
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKTWriter.trim
write(geom)
django.ref.contrib.gis.geos#django.contrib.gis.geos.WKTWriter.write
class A Alias for Area class.
django.ref.contrib.gis.measure#django.contrib.gis.measure.A
class Area(**kwargs) [source] To initialize an area object, pass in a keyword corresponding to the desired unit attribute name set with desired value. For example, the following creates an area object representing 5 square miles: >>> a = Area(sq_mi=5) __getattr__(unit_att) Returns the area value in units corresp...
django.ref.contrib.gis.measure#django.contrib.gis.measure.Area
__getattr__(unit_att)
django.ref.contrib.gis.measure#django.contrib.gis.measure.Area.__getattr__
class D Alias for Distance class.
django.ref.contrib.gis.measure#django.contrib.gis.measure.D
class Distance(**kwargs) [source] To initialize a distance object, pass in a keyword corresponding to the desired unit attribute name set with desired value. For example, the following creates a distance object representing 5 miles: >>> dist = Distance(mi=5) __getattr__(unit_att) Returns the distance value in un...
django.ref.contrib.gis.measure#django.contrib.gis.measure.Distance
__getattr__(unit_att)
django.ref.contrib.gis.measure#django.contrib.gis.measure.Distance.__getattr__
class LayerMapping(model, data_source, mapping, layer=0, source_srs=None, encoding=None, transaction_mode='commit_on_success', transform=True, unique=True, using='default')
django.ref.contrib.gis.layermapping#django.contrib.gis.utils.LayerMapping
LayerMapping.save(verbose=False, fid_range=False, step=False, progress=False, silent=False, stream=sys.stdout, strict=False)
django.ref.contrib.gis.layermapping#django.contrib.gis.utils.LayerMapping.save
mapping(data_source, geom_name='geom', layer_key=0, multi_geom=False)
django.ref.contrib.gis.ogrinspect#django.contrib.gis.utils.mapping
class FileResponse(open_file, as_attachment=False, filename='', **kwargs) FileResponse is a subclass of StreamingHttpResponse optimized for binary files. It uses wsgi.file_wrapper if provided by the wsgi server, otherwise it streams the file out in small chunks. If as_attachment=True, the Content-Disposition header i...
django.ref.request-response#django.http.FileResponse
FileResponse.set_headers(open_file) This method is automatically called during the response initialization and set various headers (Content-Length, Content-Type, and Content-Disposition) depending on open_file.
django.ref.request-response#django.http.FileResponse.set_headers
class django.http.Http404
django.topics.http.views#django.http.Http404
class HttpRequest
django.ref.request-response#django.http.HttpRequest
HttpRequest.__iter__() 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. A common use-case would be to process a big XML payload with an iterative parser without constructing a whole XML tree in memory. Gi...
django.ref.request-response#django.http.HttpRequest.__iter__
HttpRequest.accepts(mime_type) Returns True if the request Accept header matches the mime_type argument: >>> request.accepts('text/html') True Most browsers send Accept: */* by default, so this would return True for all content types. Setting an explicit Accept header in API requests can be useful for returning a di...
django.ref.request-response#django.http.HttpRequest.accepts
HttpRequest.body 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. You can also read from an HttpRequest using a file-like interface with HttpRequest...
django.ref.request-response#django.http.HttpRequest.body
HttpRequest.build_absolute_uri(location=None) Returns the absolute URI form of location. If no location is provided, the location will be set to request.get_full_path(). If the location is already an absolute URI, it will not be altered. Otherwise the absolute URI is built using the server variables available in this...
django.ref.request-response#django.http.HttpRequest.build_absolute_uri
HttpRequest.content_params A dictionary of key/value parameters included in the CONTENT_TYPE header.
django.ref.request-response#django.http.HttpRequest.content_params
HttpRequest.content_type A string representing the MIME type of the request, parsed from the CONTENT_TYPE header.
django.ref.request-response#django.http.HttpRequest.content_type
HttpRequest.COOKIES A dictionary containing all cookies. Keys and values are strings.
django.ref.request-response#django.http.HttpRequest.COOKIES
HttpRequest.current_app The url template tag will use its value as the current_app argument to reverse().
django.ref.request-response#django.http.HttpRequest.current_app
HttpRequest.encoding A string representing the current encoding used to decode form submission data (or None, which means the DEFAULT_CHARSET setting is used). You can write to this attribute to change the encoding used when accessing the form data. Any subsequent attribute accesses (such as reading from GET or POST)...
django.ref.request-response#django.http.HttpRequest.encoding
HttpRequest.exception_reporter_class This will be used instead of DEFAULT_EXCEPTION_REPORTER for the current request. See Custom error reports for details.
django.ref.request-response#django.http.HttpRequest.exception_reporter_class
HttpRequest.exception_reporter_filter This will be used instead of DEFAULT_EXCEPTION_REPORTER_FILTER for the current request. See Custom error reports for details.
django.ref.request-response#django.http.HttpRequest.exception_reporter_filter
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. See Managing files for more information. FILES will only contain data if the request method was POST and the <form> that posted to the r...
django.ref.request-response#django.http.HttpRequest.FILES
HttpRequest.GET A dictionary-like object containing all given HTTP GET parameters. See the QueryDict documentation below.
django.ref.request-response#django.http.HttpRequest.GET
HttpRequest.get_full_path() Returns the path, plus an appended query string, if applicable. Example: "/music/bands/the_beatles/?print=true"
django.ref.request-response#django.http.HttpRequest.get_full_path
HttpRequest.get_full_path_info() Like get_full_path(), but uses path_info instead of path. Example: "/minfo/music/bands/the_beatles/?print=true"
django.ref.request-response#django.http.HttpRequest.get_full_path_info
HttpRequest.get_host() Returns the originating host of the request using information from the HTTP_X_FORWARDED_HOST (if USE_X_FORWARDED_HOST is enabled) and HTTP_HOST headers, in that order. If they don’t provide a value, the method uses a combination of SERVER_NAME and SERVER_PORT as detailed in PEP 3333. Example: "...
django.ref.request-response#django.http.HttpRequest.get_host
HttpRequest.get_port() Returns the originating port of the request using information from the HTTP_X_FORWARDED_PORT (if USE_X_FORWARDED_PORT is enabled) and SERVER_PORT META variables, in that order.
django.ref.request-response#django.http.HttpRequest.get_port
HttpRequest.get_signed_cookie(key, default=RAISE_ERROR, salt='', max_age=None) Returns a cookie value for a signed cookie, or raises a django.core.signing.BadSignature exception if the signature is no longer valid. If you provide the default argument the exception will be suppressed and that default value will be ret...
django.ref.request-response#django.http.HttpRequest.get_signed_cookie
HttpRequest.headers A case insensitive, dict-like object that provides access to all HTTP-prefixed headers (plus Content-Length and Content-Type) from the request. The name of each header is stylized with title-casing (e.g. User-Agent) when it’s displayed. You can access headers case-insensitively: >>> request.header...
django.ref.request-response#django.http.HttpRequest.headers
HttpRequest.is_secure() Returns True if the request is secure; that is, if it was made with HTTPS.
django.ref.request-response#django.http.HttpRequest.is_secure
HttpRequest.META A dictionary containing all available HTTP headers. Available headers depend on the client and server, but here are some examples: CONTENT_LENGTH – The length of the request body (as a string). CONTENT_TYPE – The MIME type of the request body. HTTP_ACCEPT – Acceptable content types for the respon...
django.ref.request-response#django.http.HttpRequest.META
HttpRequest.method A string representing the HTTP method used in the request. This is guaranteed to be uppercase. For example: if request.method == 'GET': do_something() elif request.method == 'POST': do_something_else()
django.ref.request-response#django.http.HttpRequest.method
HttpRequest.path A string representing the full path to the requested page, not including the scheme, domain, or query string. Example: "/music/bands/the_beatles/"
django.ref.request-response#django.http.HttpRequest.path
HttpRequest.path_info Under some web server configurations, the portion of the URL after the host name is split up into a script prefix portion and a path info portion. The path_info attribute always contains the path info portion of the path, no matter what web server is being used. Using this instead of path can ma...
django.ref.request-response#django.http.HttpRequest.path_info
HttpRequest.POST A dictionary-like object containing all given HTTP POST parameters, providing that the request contains form data. See the QueryDict documentation below. If you need to access raw or non-form data posted in the request, access this through the HttpRequest.body attribute instead. It’s possible that a ...
django.ref.request-response#django.http.HttpRequest.POST
HttpRequest.read(size=None)
django.ref.request-response#django.http.HttpRequest.read
HttpRequest.readline()
django.ref.request-response#django.http.HttpRequest.readline
HttpRequest.readlines()
django.ref.request-response#django.http.HttpRequest.readlines
HttpRequest.resolver_match An instance of ResolverMatch representing the resolved URL. This attribute is only set after URL resolving took place, which means it’s available in all views but not in middleware which are executed before URL resolving takes place (you can use it in process_view() though).
django.ref.request-response#django.http.HttpRequest.resolver_match
HttpRequest.scheme A string representing the scheme of the request (http or https usually).
django.ref.request-response#django.http.HttpRequest.scheme
HttpRequest.session From the SessionMiddleware: A readable and writable, dictionary-like object that represents the current session.
django.ref.request-response#django.http.HttpRequest.session
HttpRequest.site From the CurrentSiteMiddleware: An instance of Site or RequestSite as returned by get_current_site() representing the current site.
django.ref.request-response#django.http.HttpRequest.site
HttpRequest.urlconf This will be used as the root URLconf for the current request, overriding the ROOT_URLCONF setting. See How Django processes a request for details. urlconf can be set to None to revert any changes made by previous middleware and return to using the ROOT_URLCONF.
django.ref.request-response#django.http.HttpRequest.urlconf
HttpRequest.user From the AuthenticationMiddleware: An instance of AUTH_USER_MODEL representing the currently logged-in user. If the user isn’t currently logged in, user will be set to an instance of AnonymousUser. You can tell them apart with is_authenticated, like so: if request.user.is_authenticated: ... # Do ...
django.ref.request-response#django.http.HttpRequest.user
class HttpResponse
django.ref.request-response#django.http.HttpResponse
HttpResponse.__delitem__(header) Deletes the header with the given name. Fails silently if the header doesn’t exist. Case-insensitive.
django.ref.request-response#django.http.HttpResponse.__delitem__
HttpResponse.__getitem__(header) Returns the value for the given header name. Case-insensitive.
django.ref.request-response#django.http.HttpResponse.__getitem__
HttpResponse.__init__(content=b'', content_type=None, status=200, reason=None, charset=None, headers=None) Instantiates an HttpResponse object with the given page content, content type, and headers. content is most commonly an iterator, bytestring, memoryview, or string. Other types will be converted to a bytestring ...
django.ref.request-response#django.http.HttpResponse.__init__
HttpResponse.__setitem__(header, value) Sets the given header name to the given value. Both header and value should be strings.
django.ref.request-response#django.http.HttpResponse.__setitem__
HttpResponse.charset A string denoting the charset in which the response will be encoded. If not given at HttpResponse instantiation time, it will be extracted from content_type and if that is unsuccessful, the DEFAULT_CHARSET setting will be used.
django.ref.request-response#django.http.HttpResponse.charset
HttpResponse.close() This method is called at the end of the request directly by the WSGI server.
django.ref.request-response#django.http.HttpResponse.close
HttpResponse.closed True if the response has been closed.
django.ref.request-response#django.http.HttpResponse.closed
HttpResponse.content A bytestring representing the content, encoded from a string if necessary.
django.ref.request-response#django.http.HttpResponse.content
HttpResponse.delete_cookie(key, path='/', domain=None, samesite=None) Deletes the cookie with the given key. Fails silently if the key doesn’t exist. Due to the way cookies work, path and domain should be the same values you used in set_cookie() – otherwise the cookie may not be deleted.
django.ref.request-response#django.http.HttpResponse.delete_cookie
HttpResponse.flush() This method makes an HttpResponse instance a file-like object.
django.ref.request-response#django.http.HttpResponse.flush
HttpResponse.get(header, alternate=None) Returns the value for the given header, or an alternate if the header doesn’t exist.
django.ref.request-response#django.http.HttpResponse.get
HttpResponse.getvalue() Returns the value of HttpResponse.content. This method makes an HttpResponse instance a stream-like object.
django.ref.request-response#django.http.HttpResponse.getvalue
HttpResponse.has_header(header) Returns True or False based on a case-insensitive check for a header with the given name.
django.ref.request-response#django.http.HttpResponse.has_header
HttpResponse.headers New in Django 3.2. A case insensitive, dict-like object that provides an interface to all HTTP headers on the response. See Setting header fields.
django.ref.request-response#django.http.HttpResponse.headers
HttpResponse.items() Acts like dict.items() for HTTP headers on the response.
django.ref.request-response#django.http.HttpResponse.items
HttpResponse.readable() Always False. This method makes an HttpResponse instance a stream-like object.
django.ref.request-response#django.http.HttpResponse.readable
HttpResponse.reason_phrase The HTTP reason phrase for the response. It uses the HTTP standard’s default reason phrases. Unless explicitly set, reason_phrase is determined by the value of status_code.
django.ref.request-response#django.http.HttpResponse.reason_phrase