mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #18451 -- Vastly improved class based view documentation.
Many thanks to Daniel Greenfeld, James Aylett, Marc Tamlyn, Simon Williams, Danilo Bargen and Luke Plant for their work on this.
This commit is contained in:
@@ -90,6 +90,9 @@ class View(object):
|
||||
return http.HttpResponseNotAllowed(self._allowed_methods())
|
||||
|
||||
def options(self, request, *args, **kwargs):
|
||||
"""
|
||||
Handles responding to requests for the OPTIONS HTTP verb.
|
||||
"""
|
||||
response = http.HttpResponse()
|
||||
response['Allow'] = ', '.join(self._allowed_methods())
|
||||
response['Content-Length'] = 0
|
||||
@@ -108,7 +111,11 @@ class TemplateResponseMixin(object):
|
||||
|
||||
def render_to_response(self, context, **response_kwargs):
|
||||
"""
|
||||
Returns a response with a template rendered with the given context.
|
||||
Returns a response, using the `response_class` for this
|
||||
view, with a template rendered with the given context.
|
||||
|
||||
If any keyword arguments are provided, they will be
|
||||
passed to the constructor of the response class.
|
||||
"""
|
||||
return self.response_class(
|
||||
request = self.request,
|
||||
|
||||
Reference in New Issue
Block a user