Skip to main content

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

AttributeTypeDescription
funccallableThe view function or class-based view that will be used to handle the request.
argstupleThe positional arguments that will be passed to the view function parsed from the URL.
kwargsdictThe keyword arguments that will be passed to the view function parsed from the URL.
url_namestringThe name of the URL pattern that matched the request.
routestringThe route pattern that matched the URL.
triedlistA list of URL patterns tried before finding a match.
captured_kwargsdictThe keyword arguments captured from the URL path.
extra_kwargsdictAdditional keyword arguments provided in the URL pattern definition.
app_nameslist = []A list of application namespaces for the matched URL pattern.
app_namestringThe full application namespace string joined by colons.
namespaceslist = []A list of individual instance namespaces for the matched URL pattern.
namespacestringThe full instance namespace string joined by colons.
view_namestringThe 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

NameTypeDescription
funccallableThe view function or class-based view to be executed.
argstuplePositional arguments to be passed to the view function.
kwargsdictKeyword arguments to be passed to the view function.
url_namestr = NoneThe name of the URL pattern.
app_nameslist = NoneA list of application namespaces for the resolved URL.
namespaceslist = NoneA list of individual namespaces for the resolved URL.
routestrThe route pattern that matched. (Optional)
triedlist = NoneA list of patterns tried before a match was found.
captured_kwargsdict = NoneThe keyword arguments captured from the URL.
extra_kwargsdict = NoneAdditional keyword arguments provided by the URL pattern.