more level group

19 views
Skip to first unread message

Vittorino Parenti

unread,
Feb 7, 2012, 10:28:03 PM2/7/12
to django-admin-tools
Hi,
i've this case:

class CustomDashboard(Dashboard):
...

def init_with_context(self, context):
request = context['request']
if request.user.is_superuser:
self.children.append(Livello1(),),
...

class Livello1(modules.Group):
def __init__(self, **kwargs):
top_list = []
for year in [2010, 2011, 2012]:
top_list.append(Livello2(
title=_('Invoiced %s') % year,
))
kwargs = {
'title': _("Customer Top Ten Per Month"),
'children': top_list,
}
super(Livello1, self).__init__(**kwargs)

class Livello2(modules.Group):
def __init__(self, **kwargs):
top_list = []
for month in range(1,13):
top_list.append(Invoices(
title=_('Invoiced Month %s') % month,
children=[1,2,3],
template='admin_tools/dashboard/my_template.html'
))
kwargs = {
'title': _("AAA"),
'children': top_list,
}
super(Livello2, self).__init__(**kwargs)

The problem is in generation template with dashboard/module.html:

<div{% if index %} id="module_{{ index }}{% if subindex %}
_{{ subindex }}{% endif %}"{% endif %}
class="{{ module.render_css_classes }}">

There are index and subindex and not another level.
Is it possible in init_with_context pass a custom index?
Thanks,
Vitto

Mikhail Korobov

unread,
Feb 8, 2012, 9:47:28 AM2/8/12
to django-ad...@googlegroups.com
Hi Vitto,

I think this was fixed by this https://bitbucket.org/izi/django-admin-tools/changeset/728aabd3b2fe commit. You should be able to use nested groups with a more recent version of django-admin-tools. It is also become possible to set custom module id (module's 'id' attribute).
Reply all
Reply to author
Forward
0 new messages