ResolverMatch
This class represents the result of a successful URL resolution, encapsulating the callback function, arguments, and metadata associated with a matched route. It provides structured access to URL patterns, including application names, namespaces, and captured keyword arguments. The class also facilitates the identification of the view by generating a full path for both function-based and class-based views.
Attributes
| Attribute | Type | Description |
|---|---|---|
| func | callable | The view function or class-based view that will be used to handle the request. |
| args | tuple | The positional arguments that will be passed to the view function parsed from the URL. |
| kwargs | dict | The keyword arguments that will be passed to the view function parsed from the URL. |
| url_name | string | The name of the URL pattern that matched the request. |
| route | string | The route pattern that matched the URL. |
| tried | list | A list of URL patterns tried before finding a match. |
| captured_kwargs | dict | The keyword arguments captured from the URL path. |
| extra_kwargs | dict | Additional keyword arguments provided in the URL pattern definition. |
| app_names | list = [] | A list of application namespaces for the matched URL pattern. |
| app_name | string | The full application namespace string joined by colons. |
| namespaces | list = [] | A list of individual instance namespaces for the matched URL pattern. |
| namespace | string | The full instance namespace string joined by colons. |
| view_name | string | The fully qualified name of the view, including namespaces if present. |
Constructor
Signature
def ResolverMatch(
func: callable,
args: tuple,
kwargs: dict,
url_name: str = None,
app_names: list = None,
namespaces: list = None,
route: str,
tried: list = None,
captured_kwargs: dict = None,
extra_kwargs: dict = None
)
Parameters
| Name | Type | Description |
|---|---|---|
| func | callable | The view function or class-based view to be executed. |
| args | tuple | Positional arguments to be passed to the view function. |
| kwargs | dict | Keyword arguments to be passed to the view function. |
| url_name | str = None | The name of the URL pattern. |
| app_names | list = None | A list of application namespaces for the resolved URL. |
| namespaces | list = None | A list of individual namespaces for the resolved URL. |
| route | str | The route pattern that matched. (Optional) |
| tried | list = None | A list of patterns tried before a match was found. |
| captured_kwargs | dict = None | The keyword arguments captured from the URL. |
| extra_kwargs | dict = None | Additional keyword arguments provided by the URL pattern. |