2011-06-23 36 views

回答

0

的主要问题是,admin_tools_dashboard_preferences需要被截断(几乎每一个变化而到仪表板制成。)

而且代码的第一个片段上documentation page甚至没有为我工作。我从文档的其他部分摘录了片段,他们似乎没有任何问题。 最后,我的示例仪表板看起来像这样。 请记住截断您的偏好。

class MyDashboard(Dashboard): 

    columns = 3 

    def __init__(self, **kwargs): 
     Dashboard.__init__(self, **kwargs) 

     # will only list the django.contrib.auth models 
     self.children += [ 
      modules.ModelList('Authentication', ['django.contrib.auth.*',]) 
     ] 

     self.children.append(modules.Group(
      title="My group", 
      display="tabs", 
      children=[ 
       modules.AppList(
        title='Administration', 
        models=('django.contrib.*',) 
       ), 
       modules.AppList(
        title='Applications', 
        exclude=('django.contrib.*',) 
       ) 
      ] 
     )) 
     self.children.append(modules.LinkList(
      layout='inline', 
      children=(
       { 
        'title': 'Python website', 
        'url': 'http://www.python.org', 
        'external': True, 
        'description': 'Python programming language rocks !', 
       }, 
       ['Django website', 'http://www.djangoproject.com', True], 
       ['Some internal link', '/some/internal/link/'], 
      ) 
     ))