MCPcopy
hub / github.com/encode/django-rest-framework / preserve_builtin_query_params

Function preserve_builtin_query_params

rest_framework/reverse.py:12–29  ·  view source on GitHub ↗

Given an incoming request, and an outgoing URL representation, append the value of any built-in query parameters.

(url, request=None)

Source from the content-addressed store, hash-verified

10
11
12def preserve_builtin_query_params(url, request=None):
13 """
14 Given an incoming request, and an outgoing URL representation,
15 append the value of any built-in query parameters.
16 """
17 if request is None:
18 return url
19
20 overrides = [
21 api_settings.URL_FORMAT_OVERRIDE,
22 ]
23
24 for param in overrides:
25 if param and (param in request.GET):
26 value = request.GET[param]
27 url = replace_query_param(url, param, value)
28
29 return url
30
31
32def reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra):

Callers 2

breadcrumbs_recursiveFunction · 0.90
reverseFunction · 0.85

Calls 1

replace_query_paramFunction · 0.90

Tested by

no test coverage detected