From 2491367d4257e7aab4fe0ccef206862726ade36e Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Thu, 17 Sep 2015 11:21:35 +0000 Subject: [PATCH] Added dokuwiki traffic accountancy backend --- orchestra/admin/menu.py | 19 ++-- orchestra/contrib/bills/models.py | 3 + .../bills/templates/bills/microspective.html | 8 +- orchestra/contrib/lists/backends.py | 2 +- orchestra/contrib/mailboxes/backends.py | 2 +- .../orders/order/bill_selected_options.html | 2 +- orchestra/contrib/resources/apps.py | 1 + orchestra/contrib/resources/models.py | 7 +- orchestra/contrib/resources/signals.py | 12 ++ orchestra/contrib/saas/backends/__init__.py | 107 +++++++++++++++++- orchestra/contrib/saas/backends/dokuwikimu.py | 11 ++ orchestra/contrib/saas/backends/phplist.py | 2 +- .../contrib/saas/backends/wordpressmu.py | 101 +---------------- orchestra/contrib/saas/settings.py | 8 ++ .../migrations/0003_auto_20150917_0942.py | 34 ++++++ orchestra/contrib/services/models.py | 2 +- 16 files changed, 197 insertions(+), 124 deletions(-) create mode 100644 orchestra/contrib/resources/signals.py create mode 100644 orchestra/contrib/services/migrations/0003_auto_20150917_0942.py 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 @@