Opened 2 months ago

Closed 2 months ago

#35823 closed Cleanup/optimization (needsinfo)

Document examples for all view decorators

Reported by: Adam Johnson Owned by:
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This documentation section does not give examples of using each decorator, which makes it much harder to understand. Let’s add one example per decorator.

Change History (1)

comment:1 by Sarah Boyce, 2 months ago

Resolution: needsinfo
Status: newclosed
Triage Stage: UnreviewedAccepted

require_GET/POST/safe is probably fine as there is an example for require_http_methods

Conditional view processing has a topic with examples: https://docs.djangoproject.com/en/dev/topics/conditional-view-processing/
Vary headers has a topic with examples: https://docs.djangoproject.com/en/dev/topics/cache/#using-vary-headers
Cache control is within the cache topic with examples: https://docs.djangoproject.com/en/dev/topics/cache/#controlling-cache-using-other-headers
Append slash has an example with the linked middleware: https://docs.djangoproject.com/en/dev/ref/middleware/#django.middleware.common.CommonMiddleware

GZip compression has no example and doesn't link to the middleware (when I think it should): https://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.gzip

So I think it's roughly there but in different places.
Do you think the examples should be duplicated? Moved over? Or just more prominent links to the topics?

Note: See TracTickets for help on using tickets.
Back to Top