django-rest-framework/rest_framework
Jesse London 9c9ffb18f4
made Browsable API base template cachable: omit CSRF token when unnecessary (#7717)
HTML responses generated by the Browsable API otherwise generate
inconsistent ETAGs -- due to the presence of CSRF tokens in the response
-- even when the API is read-only, (and as such when the response
contains no resource-modifying forms, i.e. neither POST nor PUT forms,
which might require the CSRF token).

While the template was appropriately including CSRF tokens only within
POST and PUT forms, its AJAX overlay included the CSRF token in *every*
response, regardless of whether it would be needed.

This change brings the logic of the `script` block into line with that
of the rest of the template -- and such that read-only APIs (and really
the Browsable API pages of *any* read-only resources) will not
needlessly include the CSRF token, and will now be safely cachable -- by
both back-end systems and by the user agent.
2021-03-16 13:25:21 +00:00
..
authtoken Fix: authtoken.TokenProxy cannot be proxy when not installed (#7571) 2020-10-09 12:16:15 +01:00
locale Translations updated from transifex and compiled 2020-10-13 22:05:24 +02:00
management Add file option to generateschema (#7130) 2020-02-12 20:35:54 +01:00
schemas Ignore derivations of BrowsableAPIRenderer in OpenAPI schema (#7497) 2020-10-12 16:40:26 +02:00
static/rest_framework Update default.css (#7643) 2021-03-09 11:54:58 +00:00
templates/rest_framework made Browsable API base template cachable: omit CSRF token when unnecessary (#7717) 2021-03-16 13:25:21 +00:00
templatetags Drop urlize_quoted_links (#7548) 2020-09-23 15:39:06 +01:00
utils Render JSON fields with proper indentation in browsable API forms. (#6243) 2021-03-15 10:44:03 +00:00
__init__.py Version 3.12.2 2020-10-13 14:17:53 +01:00
apps.py Make DEFAULT_PAGINATION_CLASS None by default. (#5170) 2017-09-25 15:36:30 +02:00
authentication.py Fix RemovedInDjango40Warning for middleware get_resopnse() (#7513) 2020-10-09 10:48:03 +01:00
checks.py Fix punctuation in system check (#7281) 2020-04-20 16:40:05 -07:00
compat.py isort v5 (#7484) 2020-08-17 13:26:56 -07:00
decorators.py Improve the docstring on @action (#6951) 2019-12-11 15:08:54 -08:00
documentation.py Updated url()'s with path() and re_path() (#7492) 2020-08-25 13:50:02 +02:00
exceptions.py Handle tuples same as lists in ValidationError detail context (#7647) 2021-01-06 13:13:34 +00:00
fields.py Render JSON fields with proper indentation in browsable API forms. (#6243) 2021-03-15 10:44:03 +00:00
filters.py Ordering filter bug with model property serializer field (#7609) 2021-03-16 12:53:39 +00:00
generics.py Allow context to be provided to get_serializer (#7298) 2020-04-29 11:19:44 +01:00
metadata.py replace force_text with force_str 2019-08-07 21:05:24 +02:00
mixins.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
negotiation.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
pagination.py Fix 'get_page_number' implementation 2021-03-11 09:21:22 +00:00
parsers.py replace force_text with force_str 2019-08-07 21:05:24 +02:00
permissions.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
relations.py Don't catch exceptions in get_queryset (#7480) 2020-10-10 18:02:21 +01:00
renderers.py Fix OpenAPISchema rendering for timedelta (#7641) 2021-03-10 12:03:15 +00:00
request.py Fix Request docstring kwarg names (#7443) 2020-08-05 16:51:06 -07:00
response.py Remove unnecessary bytes() calls (#6626) 2019-05-30 15:05:27 -07:00
reverse.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
routers.py Updated url()'s with path() and re_path() (#7492) 2020-08-25 13:50:02 +02:00
serializers.py corrects typographical error in line 118 (#7553) 2020-09-28 08:52:17 +01:00
settings.py Add note that APISettings is an internal class (#7144) 2020-01-15 10:52:29 +00:00
status.py Adding I'm a teapot error code (#7081) 2019-12-10 09:18:35 +00:00
test.py Not include charset when charset is None (#7400) 2020-07-07 09:58:32 +01:00
throttling.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
urlpatterns.py Updated url()'s with path() and re_path() (#7492) 2020-08-25 13:50:02 +02:00
urls.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
validators.py Make CharField prohibit surrogate characters (#7026) (#7067) 2020-01-06 14:12:21 +00:00
versioning.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
views.py support multi db atomic_requests (#7739) 2021-03-03 11:15:39 +00:00
viewsets.py Check extra action func.__name__ (#7098) 2020-08-05 21:29:47 -07:00