Python django.conf.urls 模块,patterns() 实例源码

我们从Python开源项目中,提取了以下32个代码示例,用于说明如何使用django.conf.urls.patterns()

项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def i18n_patterns(prefix, *args):
    """
    Adds the language code prefix to every URL pattern within this
    function. This may only be used in the root URLconf, not in an included
    URLconf.
    """
    if isinstance(prefix, six.string_types):
        warnings.warn(
            "Calling i18n_patterns() with the `prefix` argument and with tuples "
            "instead of django.conf.urls.url() instances is deprecated and "
            "will no longer work in Django 1.10. Use a list of "
            "django.conf.urls.url() instances instead.",
            RemovedInDjango110Warning, stacklevel=2
        )
        pattern_list = patterns(prefix, *args)
    else:
        pattern_list = [prefix] + list(args)
    if not settings.USE_I18N:
        return pattern_list
    return [LocaleRegexURLResolver(pattern_list)]
项目:django-icekit    作者:ic-labs    | 项目源码 | 文件源码
def get_urls(self):
        urls = super(PublishingAdmin, self).get_urls()

        if not self.is_admin_for_publishable_model():
            return urls

        publish_name = '%spublish' % (self.get_url_name_prefix(), )
        unpublish_name = '%sunpublish' % (self.get_url_name_prefix(), )
        revert_name = '%srevert' % (self.get_url_name_prefix(), )

        publish_urls = patterns(
            '',
            url(r'^(?P<object_id>\d+)/publish/$',
                self.publish_view, name=publish_name),
            url(r'^(?P<object_id>\d+)/unpublish/$',
                self.unpublish_view, name=unpublish_name),
            url(r'^(?P<object_id>\d+)/revert/$',
                self.revert_view, name=revert_name),
        )

        return publish_urls + urls
项目:crondeamon    作者:zhoukunpeng504    | 项目源码 | 文件源码
def get_urls(self):
        return patterns("cap.cron",
                        url(r"^$","views.home"),                         #Home???
                        url(r"^test/$","views.test"),                    #test
                        url(r"^add/$","views.add"),
                        url(r"^manage/$","views.manage"),
                        url(r"^stopcron/","views.stopcron"),         #stop cron
                        url(r"^restartcron/","views.restartcron"),   #restart cron
                        url(r"^touchcron/","views.touchcron"),     #????cron
                        url(r"^removecron/","views.removecron")  ,  #??cron
                        url(r"^runrecord/","views.runrecord"),  #????
                        url(r"logsdetail/","views.logsdetail"),  #stdout stderr
                        url(r"^crondetail/$","views.crondetail"),
                        url(r"^modifycron/$","views.modifycron"),
# --------------------------------------------------------------

                        )
项目:fluentcms-publishing    作者:bashu    | 项目源码 | 文件源码
def get_urls(self):
        urls = super(PublishingAdmin, self).get_urls()

        if not self.is_admin_for_publishable_model():
            return urls

        publish_name = '%spublish' % (self.get_url_name_prefix(), )
        unpublish_name = '%sunpublish' % (self.get_url_name_prefix(), )
        revert_name = '%srevert' % (self.get_url_name_prefix(), )

        publish_urls = patterns(
            '',
            url(r'^(?P<object_id>\d+)/publish/$',
                self.publish_view, name=publish_name),
            url(r'^(?P<object_id>\d+)/unpublish/$',
                self.unpublish_view, name=unpublish_name),
            url(r'^(?P<object_id>\d+)/revert/$',
                self.revert_view, name=revert_name),
        )

        return publish_urls + urls
项目:djanoDoc    作者:JustinChavez    | 项目源码 | 文件源码
def i18n_patterns(prefix, *args):
    """
    Adds the language code prefix to every URL pattern within this
    function. This may only be used in the root URLconf, not in an included
    URLconf.
    """
    if isinstance(prefix, six.string_types):
        warnings.warn(
            "Calling i18n_patterns() with the `prefix` argument and with tuples "
            "instead of django.conf.urls.url() instances is deprecated and "
            "will no longer work in Django 1.10. Use a list of "
            "django.conf.urls.url() instances instead.",
            RemovedInDjango110Warning, stacklevel=2
        )
        pattern_list = patterns(prefix, *args)
    else:
        pattern_list = [prefix] + list(args)
    if not settings.USE_I18N:
        return pattern_list
    return [LocaleRegexURLResolver(pattern_list)]
项目:tissuelab    作者:VirtualPlants    | 项目源码 | 文件源码
def get_urls(self):
        from django.conf.urls import patterns
        return patterns('',
            (r'^(\d+)/password/$',
             self.admin_site.admin_view(self.user_change_password))
        ) + super(UserAdmin, self).get_urls()
项目:tissuelab    作者:VirtualPlants    | 项目源码 | 文件源码
def admin_view(self, view, cacheable=False):
        """
        Decorator to create an admin view attached to this ``AdminSite``. This
        wraps the view and provides permission checking by calling
        ``self.has_permission``.

        You'll want to use this from within ``AdminSite.get_urls()``:

            class MyAdminSite(AdminSite):

                def get_urls(self):
                    from django.conf.urls import patterns, url

                    urls = super(MyAdminSite, self).get_urls()
                    urls += patterns('',
                        url(r'^my_view/$', self.admin_view(some_view))
                    )
                    return urls

        By default, admin_views are marked non-cacheable using the
        ``never_cache`` decorator. If the view can be safely cached, set
        cacheable=True.
        """
        def inner(request, *args, **kwargs):
            if LOGIN_FORM_KEY in request.POST and request.user.is_authenticated():
                auth_logout(request)
            if not self.has_permission(request):
                if request.path == reverse('admin:logout',
                                           current_app=self.name):
                    index_path = reverse('admin:index', current_app=self.name)
                    return HttpResponseRedirect(index_path)
                return self.login(request)
            return view(request, *args, **kwargs)
        if not cacheable:
            inner = never_cache(inner)
        # We add csrf_protect here so this function can be used as a utility
        # function for any view, without having to repeat 'csrf_protect'.
        if not getattr(view, 'csrf_exempt', False):
            inner = csrf_protect(inner)
        return update_wrapper(inner, view)
项目:tissuelab    作者:VirtualPlants    | 项目源码 | 文件源码
def get_urls(self):
        from django.conf.urls import patterns, url

        def wrap(view):
            def wrapper(*args, **kwargs):
                return self.admin_site.admin_view(view)(*args, **kwargs)
            return update_wrapper(wrapper, view)

        info = self.model._meta.app_label, self.model._meta.model_name

        urlpatterns = patterns('',
            url(r'^$',
                wrap(self.changelist_view),
                name='%s_%s_changelist' % info),
            url(r'^add/$',
                wrap(self.add_view),
                name='%s_%s_add' % info),
            url(r'^(.+)/history/$',
                wrap(self.history_view),
                name='%s_%s_history' % info),
            url(r'^(.+)/delete/$',
                wrap(self.delete_view),
                name='%s_%s_delete' % info),
            url(r'^(.+)/$',
                wrap(self.change_view),
                name='%s_%s_change' % info),
        )
        return urlpatterns
项目:django-pgMemento    作者:onebit0fme    | 项目源码 | 文件源码
def get_urls(self):
        """ Additional views """
        from django.conf.urls import patterns, url

        def wrap(view):
            def wrapper(*args, **kwargs):
                return self.admin_site.admin_view(view)(*args, **kwargs)
            return update_wrapper(wrapper, view)

        info = self.model._meta.app_label, self.model._meta.model_name

        urls = patterns('',
                        url(r'^(.+)/subject_view/$',
                            wrap(self.subject_view),
                            name='%s_%s_subject_redirect' % info),
                        )

        super_urls = super(RowLogAdmin, self).get_urls()

        return urls + super_urls
项目:django-pgMemento    作者:onebit0fme    | 项目源码 | 文件源码
def get_urls(self):
        from django.conf.urls import patterns, url

        def wrap(view):
            def wrapper(*args, **kwargs):
                return self.admin_site.admin_view(view)(*args, **kwargs)
            return update_wrapper(wrapper, view)

        info = self.model._meta.app_label, self.model._meta.model_name

        urls = patterns('',
                        url(r'^(.+)/manage/$',
                            wrap(self.manage_view),
                            name='%s_%s_manage' % info),
                        )

        super_urls = super(VersionModelAdmin, self).get_urls()

        return urls + super_urls
项目:mes    作者:osess    | 项目源码 | 文件源码
def urls(self):
        """
        Provides URLconf details for the ``Api`` and all registered
        ``Resources`` beneath it.
        """
        pattern_list = [
            url(r"^(?P<api_name>%s)%s$" % (self.api_name, trailing_slash()), self.wrap_view('top_level'), name="api_%s_top_level" % self.api_name),
        ]

        for name in sorted(self._registry.keys()):
            self._registry[name].api_name = self.api_name
            pattern_list.append((r"^(?P<api_name>%s)/" % self.api_name, include(self._registry[name].urls)))

        urlpatterns = self.prepend_urls()

        overridden_urls = self.override_urls()
        if overridden_urls:
            warnings.warn("'override_urls' is a deprecated method & will be removed by v1.0.0. Please rename your method to ``prepend_urls``.")
            urlpatterns += overridden_urls

        urlpatterns += patterns('',
            *pattern_list
        )
        return urlpatterns
项目:django-next-train    作者:bitpixdigital    | 项目源码 | 文件源码
def i18n_patterns(prefix, *args):
    """
    Adds the language code prefix to every URL pattern within this
    function. This may only be used in the root URLconf, not in an included
    URLconf.
    """
    if isinstance(prefix, six.string_types):
        warnings.warn(
            "Calling i18n_patterns() with the `prefix` argument and with tuples "
            "instead of django.conf.urls.url() instances is deprecated and "
            "will no longer work in Django 1.10. Use a list of "
            "django.conf.urls.url() instances instead.",
            RemovedInDjango110Warning, stacklevel=2
        )
        pattern_list = patterns(prefix, *args)
    else:
        pattern_list = [prefix] + list(args)
    if not settings.USE_I18N:
        return pattern_list
    return [LocaleRegexURLResolver(pattern_list)]
项目:django-wechat-api    作者:crazy-canux    | 项目源码 | 文件源码
def i18n_patterns(prefix, *args):
    """
    Adds the language code prefix to every URL pattern within this
    function. This may only be used in the root URLconf, not in an included
    URLconf.
    """
    if isinstance(prefix, six.string_types):
        warnings.warn(
            "Calling i18n_patterns() with the `prefix` argument and with tuples "
            "instead of django.conf.urls.url() instances is deprecated and "
            "will no longer work in Django 2.0. Use a list of "
            "django.conf.urls.url() instances instead.",
            RemovedInDjango20Warning, stacklevel=2
        )
        pattern_list = patterns(prefix, *args)
    else:
        pattern_list = [prefix] + list(args)
    if not settings.USE_I18N:
        return pattern_list
    return [LocaleRegexURLResolver(pattern_list)]
项目:DCPanel    作者:vladgr    | 项目源码 | 文件源码
def create_pattern(view, path, func_name):
    ptn = url(path, admin.site.admin_view(getattr(view, func_name)))
    return patterns('', ptn,)
项目:DCPanel    作者:vladgr    | 项目源码 | 文件源码
def get_admin_urls(urls):
    def get_urls():
        my_urls = patterns('')

        my_models = (
            Server,
        )

        for MyModel in my_models:
            for path, view_name in MyModel.get_admin_urls():
                my_urls += create_pattern(views_admin, path, view_name)

        return my_urls + urls
    return get_urls
项目:rudi    作者:lexxodus    | 项目源码 | 文件源码
def get_urls(self):
        urls = super(TeamAdmin, self).get_urls()
        custom_urls = patterns(
            "",
            url(r"^mail_preview/$",
                self.admin_site.admin_view(
                    self.custom_mail_preview),
                name="custom_mail_preview"),
            url(r"^mail_confirm/$",
                self.admin_site.admin_view(
                    self.custom_mail_confirm),
                name="custom_mail_confirm"),
        )
        return custom_urls + urls
项目:esdc-ce    作者:erigones    | 项目源码 | 文件源码
def get_urls(self):
        urls = patterns(
            '',
            url(r'cancel_impersonation/$', self.admin_site.admin_view(self.stop_impersonation),
                name='stop_impersonation'),
            url(r'(?P<user_id>\d+)/impersonate/$', self.admin_site.admin_view(self.start_impersonation),
                name='start_impersonation'),
        )
        return urls + super(UserAdmin, self).get_urls()
项目:YouPBX    作者:JoneXiong    | 项目源码 | 文件源码
def urls(self):
        """
        ?? xadmin site ?urls?????django?urls??????????????Django? ``urls.py`` ????????::

            from django.conf.urls import patterns, include, url

            import xadmin
            xadmin.autodiscover()

            urlpatterns = patterns('',
                url(r'', include(xadmin.site.urls)),
            )

        """
        return self.get_urls(), self.name, self.app_name
项目:django-icekit    作者:ic-labs    | 项目源码 | 文件源码
def get_view_response(self, request, page, view_func, view_args, view_kwargs):
        """
        Render the custom view that was exposed by the extra plugin URL patterns.
        This gives the ability to add extra middleware logic.
        """
        return view_func(request, page, *view_args, **view_kwargs)
项目:django-icekit    作者:ic-labs    | 项目源码 | 文件源码
def get_urls(self):
        """
        Add ``layout_placeholder_data`` URL.
        """
        # See: `fluent_pages.pagetypes.fluentpage.admin.FluentPageAdmin`.
        urls = super(LayoutAdmin, self).get_urls()
        my_urls = patterns(
            '',
            url(
                r'^placeholder_data/(?P<id>\d+)/$',
                self.admin_site.admin_view(self.placeholder_data_view),
                name='layout_placeholder_data',
            )
        )
        return my_urls + urls
项目:crondeamon    作者:zhoukunpeng504    | 项目源码 | 文件源码
def get_urls(self):
        return patterns("cap.user_manager",
                        url(r"^user_add/$", "views.add"),
                        url(r"^user_list/$", "views.list"),
                        url(r"^delete/$","views.delete"),
                        url(r"^info/$","views.info"),
                        url(r"change/$","views.change"),


                        )
项目:crondeamon    作者:zhoukunpeng504    | 项目源码 | 文件源码
def get_urls(self):
        return  patterns("cap.task",
                         url(r"^$","views.home"),
                         url(r"^add/$","views.add"),
                         url(r"^manage/$","views.manage"),
                         url(r"^taskdetail/$","views.taskdetail"),  #task??
                         url(r"^modifytask/$","views.modifytask"),    #??task
                         url(r"^stoptask/$","views.stoptask"),       #??task
                         url(r"^starttask/$","views.starttask"),     #??task
                         url(r"^restarttask/$","views.restarttask")  ,#??task
                         url(r"^removetask/$","views.removetask")   ,  #??task
                         url(r"^logsdetail/$","views.logdetail")  ,     #??Log
                         url(r"^runrecord/$","views.runrecord")
        )
项目:montage    作者:storyful    | 项目源码 | 文件源码
def auto_patterns(module, prefix='', overview=False, namespace=''):
    """
        Automatically creates URL patterns for a given module
    """
    from django.conf.urls import patterns
    if overview and not prefix:
        raise ValueError("Prefix can't be empty if overview is True")
    urls = get_urls(module, prefix, overview, namespace)
    return patterns(module.__name__, *urls)
项目:py2swagger    作者:Arello-Mobile    | 项目源码 | 文件源码
def patterns(*args):
        return list(filter(lambda x: x, args))
项目:mes    作者:osess    | 项目源码 | 文件源码
def admin_view(self, view, cacheable=False):
        """
        Decorator to create an admin view attached to this ``AdminSite``. This
        wraps the view and provides permission checking by calling
        ``self.has_permission``.

        You'll want to use this from within ``AdminSite.get_urls()``:

            class MyAdminSite(AdminSite):

                def get_urls(self):
                    from django.conf.urls import patterns, url

                    urls = super(MyAdminSite, self).get_urls()
                    urls += patterns('',
                        url(r'^my_view/$', self.admin_view(some_view))
                    )
                    return urls

        By default, admin_views are marked non-cacheable using the
        ``never_cache`` decorator. If the view can be safely cached, set
        cacheable=True.
        """
        def inner(request, *args, **kwargs):
            if not self.has_permission(request) and getattr(view, 'need_site_permission', True):
                return self.create_admin_view(self.login_view)(request, *args, **kwargs)
            return view(request, *args, **kwargs)
        if not cacheable:
            inner = never_cache(inner)
        return update_wrapper(inner, view)
项目:mes    作者:osess    | 项目源码 | 文件源码
def get_urls(self):
        from django.conf.urls import patterns, url, include
        from xadmin.views.base import BaseAdminView

        if settings.DEBUG:
            self.check_dependencies()

        def wrap(view, cacheable=False):
            def wrapper(*args, **kwargs):
                return self.admin_view(view, cacheable)(*args, **kwargs)
            return update_wrapper(wrapper, view)

        # Admin-site-wide views.
        urlpatterns = patterns('',
                               url(r'^jsi18n/$', wrap(self.i18n_javascript,
                                                      cacheable=True), name='jsi18n')
                               )

        # Registed admin views
        urlpatterns += patterns('',
                                *[url(
                                  path, wrap(self.create_admin_view(clz_or_func)) if type(clz_or_func) == type and issubclass(clz_or_func, BaseAdminView) else include(clz_or_func(self)),
                                  name=name) for path, clz_or_func, name in self._registry_views]
                                )

        # Add in each model's views.
        for model, admin_class in self._registry.iteritems():
            view_urls = [url(
                path, wrap(
                    self.create_model_admin_view(clz, model, admin_class)),
                name=name % (model._meta.app_label, model._meta.module_name))
                for path, clz, name in self._registry_modelviews]
            urlpatterns += patterns('',
                                    url(
                                    r'^%s/%s/' % (
                                        model._meta.app_label, model._meta.module_name),
                                    include(patterns('', *view_urls)))
                                    )

        return urlpatterns
项目:mes    作者:osess    | 项目源码 | 文件源码
def get_urls(self):
        """Returns the additional urls used by the Reversion admin."""
        urls = super(VersionAdmin, self).get_urls()
        admin_site = self.admin_site
        opts = self.model._meta
        info = opts.app_label, opts.module_name,
        reversion_urls = patterns("",
                                  url("^recover/$", admin_site.admin_view(self.recoverlist_view), name='%s_%s_recoverlist' % info),
                                  url("^recover/([^/]+)/$", admin_site.admin_view(self.recover_view), name='%s_%s_recover' % info),
                                  url("^([^/]+)/history/([^/]+)/$", admin_site.admin_view(self.revision_view), name='%s_%s_revision' % info),)
        return reversion_urls + urls
项目:mes    作者:osess    | 项目源码 | 文件源码
def get_urls(self):
        info = self.model._meta.app_label, self.model._meta.module_name
        return patterns('',
            url(r'^$',
                self.admin_site.admin_view(self.changelist_view),
                name='%s_%s_changelist' % info),
            url(r'^$',
                self.admin_site.admin_view(self.changelist_view),
                name='%s_%s_add' % info),
        )
项目:Sentry    作者:NetEaseGame    | 项目源码 | 文件源码
def get_urls(self):
        from django.conf.urls import patterns
        return patterns('',
            (r'^(\d+)/password/$',
             self.admin_site.admin_view(self.user_change_password))
        ) + super(UserAdmin, self).get_urls()
项目:pyconjp-website    作者:pyconjp    | 项目源码 | 文件源码
def gen_urls():
    include_patterns = patterns("",
                                url(r"^$", TemplateView.as_view(template_name="homepage.html"),
                                    name="home"),
                                url(r"^admin/", include(admin.site.urls)),
                                url(r"^account/signup/$", pycon.profile.views.SignupView.as_view(),
                                    name="account_signup"),
                                url(r"^account/login/$", symposion.views.LoginView.as_view(), name="account_login"),
                                url(r"^account/social/", include("social_auth.urls")),
                                url(r"^account/associations/", include("symposion.social_auth.urls")),
                                url(r"^account/", include("account.urls")),
                                url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
                                url(r"^blog/", include("biblion.urls")),
                                url(r"^force500/", lambda request: xxx),
                                url(r"^registration/", include("pycon.registration.urls")),
                                url(r"^finaid/", include("pycon.finaid.urls")),
                                url(r"^pycon_api/", include("pycon.pycon_api.urls")),
                                url(r"^api/", include("pycon.apis.urls")),
                                url(r"^schedule/", include("pycon.schedule.urls")),
                                url(r"^profile/", include("pycon.profile.urls")),
                                url(r"^tutorials/", include("pycon.tutorials.urls")),

                                url(r"^speaker/", include("symposion.speakers.urls")),
                                url(r"^speaker/list$", speaker_views.speaker_list, name='speaker_list'),
                                url(r"^proposals/", include("pycon.proposals.urls")),
                                url(r"^reviews/", include("symposion.reviews.urls")),
                                url(r"^teams/", include("symposion.teams.urls")),
                                url(r"^schedule/", include("symposion.schedule.urls")),
                                url(r"^conference/", include("symposion.conference.urls")),

                                url(r"^sponsors/", include("pycon.sponsorship.urls")),

                                url(r"^boxes/", include("symposion.boxes.urls")),
                                url(r"^sitemap/", TemplateView.as_view(template_name="static/sitemap.html"),
                                    name="sitemap"),
                                url(r'^selectable/', include('selectable.urls')),
                                url(r"^change_language/", symposion.views.change_language, name="change_language"),
                                url(r"^", include("pycon.urls")),

                                # This should be last, because it will create a new CMS page for
                                # any unrecognized URL.
                                url(r"^", include("restcms.urls")),
                                url(r'^localeurl/', include('localeurlcustom.urls')),
    )

    for key, val in settings.LANGUAGES:
        yield url(r"^%s/%s/" % (URL_PREFIX, key), include(include_patterns))
项目:YouPBX    作者:JoneXiong    | 项目源码 | 文件源码
def get_urls(self):
        from django.conf.urls import patterns, url, include
        from xadmin.views.base import BaseView

        if settings.DEBUG:
            # ???DEBUG???????
            self.check_dependencies()

        #: ????????? AdminSite.admin_view ?? view
        def wrap(view, cacheable=False):
            '''
            url????????????view??
            '''
            def wrapper(*args, **kwargs):
                return self.site_view_decor(view, cacheable)(*args, **kwargs)
            return update_wrapper(wrapper, view)

        # ?? i18n_javascript view? ??js????
        urlpatterns = patterns('',
                               url(r'^jsi18n/$', wrap(self.i18n_javascript,
                                                      cacheable=True), name='jsi18n')
                               )

        # ??????? AdminViewClass
        urlpatterns += patterns('',
                                *[url(
                                  path, wrap(self.create_admin_view(clz_or_func)) if type(clz_or_func) == type and issubclass(clz_or_func, BaseView) else include(clz_or_func(self)),
                                  name=name) for path, clz_or_func, name in self._registry_views]
                                )

        # ???????? Model, ?????ModelAdminViewClass
        for model, admin_class in self._registry.iteritems():
            view_urls = []
            app_label = model._meta.app_label
            module_name = model._meta.module_name
            for path, clz, name in self._registry_modelviews:
                view_attr_name = name.replace('%s_%s','view')
                name = name % (app_label, module_name)
                if hasattr(admin_class, view_attr_name):
                    view_class = getattr(admin_class, view_attr_name)
                    clz = view_class or clz
                m_view = wrap( self.create_model_admin_view(clz, model, admin_class) )
                view_urls.append( url(path, m_view, name=name) )
            urlpatterns += patterns('',
                                        url(
                                            r'^%s/%s/' % (app_label, module_name),
                                            include(patterns('', *view_urls))
                                        )
                                    )

        return urlpatterns
项目:tissuelab    作者:VirtualPlants    | 项目源码 | 文件源码
def get_urls(self):
        from django.conf.urls import patterns, url, include

        if settings.DEBUG:
            self.check_dependencies()

        def wrap(view, cacheable=False):
            def wrapper(*args, **kwargs):
                return self.admin_view(view, cacheable)(*args, **kwargs)
            return update_wrapper(wrapper, view)

        # Admin-site-wide views.
        urlpatterns = patterns('',
            url(r'^$',
                wrap(self.index),
                name='index'),
            url(r'^logout/$',
                wrap(self.logout),
                name='logout'),
            url(r'^password_change/$',
                wrap(self.password_change, cacheable=True),
                name='password_change'),
            url(r'^password_change/done/$',
                wrap(self.password_change_done, cacheable=True),
                name='password_change_done'),
            url(r'^jsi18n/$',
                wrap(self.i18n_javascript, cacheable=True),
                name='jsi18n'),
            url(r'^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$',
                wrap(contenttype_views.shortcut),
                name='view_on_site'),
            url(r'^(?P<app_label>\w+)/$',
                wrap(self.app_index),
                name='app_list')
        )

        # Add in each model's views.
        for model, model_admin in six.iteritems(self._registry):
            urlpatterns += patterns('',
                url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name),
                    include(model_admin.urls))
            )
        return urlpatterns