diff --git a/orchestra/admin/menu.py b/orchestra/admin/menu.py
index 27c81a36..6f5db81e 100644
--- a/orchestra/admin/menu.py
+++ b/orchestra/admin/menu.py
@@ -29,30 +29,33 @@ def api_link(context):
def process_registry(register):
- def get_item(model, options, parent=False):
- name = options.get('verbose_name_plural')
+ def get_item(model, options, name=None):
+ if name is None:
+ name = capfirst(options.get('verbose_name_plural'))
if isinstance(model, str):
url = reverse('admin:'+model)
else:
opts = model._meta
url = reverse('admin:{}_{}_changelist'.format(
- opts.app_label, opts.model_name))
- if parent:
- name = opts.app_label
- name = capfirst(name)
- return items.MenuItem(name, url)
+ opts.app_label, opts.model_name)
+ )
+ item = items.MenuItem(name, url)
+ item.options = options
+ return item
childrens = {}
for model, options in register.get().items():
if options.get('menu', True):
parent = options.get('parent')
if parent:
+ name = capfirst(model._meta.app_label)
parent_item = childrens.get(parent)
if parent_item:
if not parent_item.children:
parent_item.children.append(deepcopy(parent_item))
+ parent_item.title = name
else:
- parent_item = get_item(parent, register[parent], parent=True)
+ parent_item = get_item(parent, register[parent], name=name)
parent_item.children = []
parent_item.children.append(get_item(model, options))
childrens[parent] = parent_item
diff --git a/orchestra/contrib/bills/models.py b/orchestra/contrib/bills/models.py
index d60aea9c..011ea2d4 100644
--- a/orchestra/contrib/bills/models.py
+++ b/orchestra/contrib/bills/models.py
@@ -458,3 +458,6 @@ class BillSubline(models.Model):
description = models.CharField(_("description"), max_length=256)
total = models.DecimalField(max_digits=12, decimal_places=2)
type = models.CharField(_("type"), max_length=16, choices=TYPES, default=OTHER)
+
+ def __str__(self):
+ return "%s %i" % (self.description, self.total)
diff --git a/orchestra/contrib/bills/templates/bills/microspective.html b/orchestra/contrib/bills/templates/bills/microspective.html
index 8662695f..86b1cbbf 100644
--- a/orchestra/contrib/bills/templates/bills/microspective.html
+++ b/orchestra/contrib/bills/templates/bills/microspective.html
@@ -79,7 +79,7 @@
{% for line in lines %}
{% with sublines=line.sublines.all description=line.description|slice:"38:" %}
{% if not line.order_id %}L{% endif %}{{ line.order_id|default:line.pk }}
- {{ line.description|slice:":38" }}
+ {{ line.description|safe|slice:":38" }}
{{ line.get_verbose_period }}
{{ line.get_verbose_quantity|default:" "|safe }}
{% if line.rate %}{{ line.rate }} &{{ currency.lower }};{% else %} {% endif %}
@@ -87,7 +87,7 @@
{% if description %}
- {{ description|truncatechars:39 }}
+ {{ description|safe|truncatechars:39 }}
@@ -95,7 +95,7 @@
{% endif %}
{% for subline in sublines %}
- {{ subline.description|truncatechars:39 }}
+ {{ subline.description|safe|truncatechars:39 }}
@@ -126,9 +126,11 @@