django.conf.urls.url.split - python examples

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

1 Examples 7

0 View Complete Implementation : urls.py
Copyright Apache License 2.0
Author : c3nav
    @cached_property
    def urls(self):
        include_editor = can_access_editor(self.request)
        urls = OrderedDict()
        for urlpattern in router.urls:
            if not include_editor and inspect.getmodule(urlpattern.callback).__name__.startswith('c3nav.editor.'):
                continue
            name = urlpattern.name
            url = self._format_pattern(str(urlpattern.pattern)).replace('{pk}', '{id}')
            base = url.split('/', 1)[0]
            if base == 'editor':
                if name == 'editor-list':
                    continue
                if name == 'editor-detail':
                    name = 'editor-api'
            elif base == 'session':
                if name == 'session-list':
                    name = 'session-info'
            if '-' in name:
                urls.setdefault(base, OrderedDict())[name.split('-', 1)[1]] = url
            else:
                urls[name] = url
        return urls