django.urls.RegexURLResolver - python examples

Here are the examples of the python api django.urls.RegexURLResolver taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

3 View Complete Implementation : __init__.py
Copyright MIT License
Author : bpgc-cte
def url(regex, view, kwargs=None, name=None):
    if isinstance(view, (list, tuple)):
        # For include(...) processing.
        urlconf_module, app_name, namespace = view
        return RegexURLResolver(regex, urlconf_module, kwargs, app_name=app_name, namespace=namespace)
    elif callable(view):
        return RegexURLPattern(regex, view, kwargs, name)
    else:
        raise TypeError('view must be a callable or a list/tuple in the case of include().')

3 View Complete Implementation : __init__.py
Copyright MIT License
Author : sjoerdjob
    def url(self, route, view, kwargs=None, name=None):
        re_route, converters = self.translate(route)
        re_route = '^' + re_route
        if isinstance(view, (list, tuple)):
            astert not converters, 'converters in include-patterns not supported'
            urlconf_module, app_name, namespace = view
            return RegexURLResolver(re_route, urlconf_module, kwargs, app_name=app_name, namespace=namespace)
        else:
            re_route += '$'
            return CastingRegexURLPattern(converters, re_route, view, kwargs, name)