diff --git a/orchestra/admin/menu.py b/orchestra/admin/menu.py index cb9c1927..0b4362f0 100644 --- a/orchestra/admin/menu.py +++ b/orchestra/admin/menu.py @@ -62,6 +62,8 @@ def get_account_items(): if isinstalled('orchestra.apps.payments'): url = reverse('admin:payments_transaction_changelist') childrens.append(items.MenuItem(_("Transactions"), url)) + url = reverse('admin:payments_paymentsource_changelist') + childrens.append(items.MenuItem(_("Payment Sources"), url)) if isinstalled('orchestra.apps.issues'): url = reverse('admin:issues_ticket_changelist') childrens.append(items.MenuItem(_("Tickets"), url)) diff --git a/orchestra/apps/accounts/admin.py b/orchestra/apps/accounts/admin.py index fd046721..64820300 100644 --- a/orchestra/apps/accounts/admin.py +++ b/orchestra/apps/accounts/admin.py @@ -9,7 +9,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin from orchestra.admin.utils import wrap_admin_view, admin_link -from orchestra.core import services +from orchestra.core import services, accounts from .filters import HasMainUserListFilter from .forms import AccountCreationForm, AccountChangeForm @@ -60,10 +60,13 @@ class AccountAdmin(ExtendedModelAdmin): if not account.is_active: messages.warning(request, 'This account is disabled.') context = { - # TODO not services but everythin (payments, bills, etc) 'services': sorted( [ model._meta for model in services.get() if model is not Account ], key=lambda i: i.verbose_name_plural.lower() + ), + 'accounts': sorted( + [ model._meta for model in accounts.get() if model is not Account ], + key=lambda i: i.verbose_name_plural.lower() ) } context.update(extra_context or {}) @@ -83,8 +86,9 @@ class AccountAdmin(ExtendedModelAdmin): def get_queryset(self, request): """ Select related for performance """ # TODO move invoicecontact to contacts + qs = super(AccountAdmin, self).get_queryset(request) related = ('user', 'invoicecontact') - return super(AccountAdmin, self).get_queryset(request).select_related(*related) + return qs.select_related(*related) admin.site.register(Account, AccountAdmin) diff --git a/orchestra/apps/accounts/templates/admin/accounts/account/change_form.html b/orchestra/apps/accounts/templates/admin/accounts/account/change_form.html index 52598a41..d93f4d97 100644 --- a/orchestra/apps/accounts/templates/admin/accounts/account/change_form.html +++ b/orchestra/apps/accounts/templates/admin/accounts/account/change_form.html @@ -3,11 +3,28 @@ {% block object-tools-items %} + + {% for service in services %}
  • {{ service.verbose_name_plural|capfirst }}
  • {% endfor %} + + + +
    Account
    + +

    +
    a
    + +