HttpResponseNotAcceptable(content=”, *args, **kwargs)¶
Sets the Last-Modified header in a response based on a DateTimeField.
Checks if a Last-Modified timestamp is newer than the requested HTTP_IF_MODIFIED_SINCE from the browser. This can be used to bail early if no updates have been performed since the last access to the page.
This can take a DateField, datetime, HTTP date-formatted string, or a function for the last_modified timestamp. If a function is passed, it will only be called if the HTTP_IF_MODIFIED_SINCE header is present.
Sets the ETag header in a response.
Encode a string as a SHA1 value, for use in an ETag.
Checks if an ETag matches the If-None-Match header sent by the browser. This can be used to bail early if no updates have been performed since the last access to the page.
Checks if an ETag matches the If-Match header sent by the browser. This is used by PUT requests to to indicate that the update should only happen if the specified ETag matches the header.
Returns lists of mimetypes from the request’s Accept header.
This will return two lists, a list of acceptable mimetypes in order of requested priority, and a list of unacceptable mimetypes.
Gets the mimetype that should be used for returning content.
This is based on the client’s requested list of mimetypes (in the HTTP Accept header) and the supported list of mimetypes that can be returned in this request.
If a valid mimetype that can be used is found, it will be returned. Otherwise, None is returned, and the caller is expected to return HttpResponseNotAccepted.
Returns whether or not a given mimetype is a subset of another.
This is generally used to determine if vendor-specific mimetypes is a subset of another type. For example, application/vnd.djblets.foo+json is a subset of application/json.
Return a URL query string that filters out some params.
This is used often when one wants to preserve some GET parameters and not others.