Hi All,
    When I was reading django document, I also viewed the source code
of the framework to help me understand,
    but I found one inconsistent place about urls attribute of
Django's AdminSite object.

    # in djangoproject document, 
http://docs.djangoproject.com/en/dev/topics/http/urls/:
     ** This will include the nominated URL patterns into the given
application and instance namespace. For example, the urls attribute of
Django's AdminSite object returns a 3-tuple that contains all the
patterns in an admin site, plus the name of the admin instance, and
the application namespace admin.
    # in source code:  /django/contrib/admin/options.py
     def urls(self):
        return self.get_urls()
    urls = property(urls)
  def get_urls(self):
        from django.conf.urls.defaults 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.module_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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to