Vittorino Parenti
unread,Feb 7, 2012, 10:28:03 PM2/7/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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