From eb4673b3c467fb63a1fad78d3b05ed91a730d786 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Wed, 7 Oct 2015 22:05:00 +0000 Subject: [PATCH] Added Admin global search view --- TODO.md | 11 +++- orchestra/admin/dashboard.py | 11 +++- orchestra/contrib/accounts/actions.py | 2 +- .../accounts/account/service_report.html | 20 ++++++- orchestra/contrib/orders/apps.py | 2 +- orchestra/contrib/payments/apps.py | 4 +- orchestra/contrib/resources/models.py | 9 +++ orchestra/contrib/vps/admin.py | 1 + orchestra/core/__init__.py | 5 ++ .../orchestra/css/adminextraprettystyle.css | 4 +- orchestra/templates/admin/orchestra/menu.html | 7 ++- .../templates/admin/orchestra/search.html | 19 ++++++ orchestra/urls.py | 1 + orchestra/views.py | 59 ++++++++++++++++++- 14 files changed, 142 insertions(+), 13 deletions(-) create mode 100644 orchestra/templates/admin/orchestra/search.html diff --git a/TODO.md b/TODO.md index efb56e1d..ac85f71e 100644 --- a/TODO.md +++ b/TODO.md @@ -93,7 +93,7 @@ Php binaries should have this format: /usr/bin/php5.2-cgi * logs on panel/logs/ ? mkdir ~webapps, backend post save signal? * and other IfModule on backend SecRule -* Orchestra global search box on the page head, based https://github.com/django/django/blob/master/django/contrib/admin/options.py#L866 and iterating over all registered services and inspectin its admin.search_fields +# Orchestra global search box on the page head, based https://github.com/django/django/blob/master/django/contrib/admin/options.py#L866 and iterating over all registered services and inspectin its admin.search_fields * contain error on plugin missing key (plugin dissabled): NOP, fail hard is better than silently, perhaps fail at starttime? apploading machinary @@ -131,6 +131,7 @@ require_once(‘/etc/moodles/’.$moodle_host.‘config.php’);``` moodle/drupl * document service help things: discount/refound/compensation effect and metric table * Document metric interpretation help_text * document plugin serialization, data_serializer? +* Document strong input validation # bill line managemente, remove, undo (only when possible), move, copy, paste * budgets: no undo feature @@ -415,3 +416,11 @@ mkhomedir_helper or create ssh homes with bash.rc and such # setupforbiddendomains --url alexa -n 5000 + + +* remove welcome box on dashboard? + +# account contacts inline, show provided fields and ignore the rest? +# email usage -webkit-column-count:3;-moz-column-count:3;column-count:3; + +# resources on service report diff --git a/orchestra/admin/dashboard.py b/orchestra/admin/dashboard.py index 1e09822d..5cded62c 100644 --- a/orchestra/admin/dashboard.py +++ b/orchestra/admin/dashboard.py @@ -19,6 +19,15 @@ class AppDefaultIconList(CmsAppIconList): class OrchestraIndexDashboard(dashboard.FluentIndexDashboard): """ Gets application modules from services, accounts and administration registries """ + + def __init__(self, **kwargs): + super(dashboard.FluentIndexDashboard, self).__init__(**kwargs) + self.children.append(self.get_personal_module()) + self.children.extend(self.get_application_modules()) + recent_actions = self.get_recent_actions_module() + recent_actions.enabled = True + self.children.append(recent_actions) + def process_registered_view(self, module, view_name, options): app_name, name = view_name.split('_')[:-1] module.icons['.'.join((app_name, name))] = options.get('icon') @@ -44,7 +53,7 @@ class OrchestraIndexDashboard(dashboard.FluentIndexDashboard): # Honor settings override, hacky. I Know if appsettings.FLUENT_DASHBOARD_APP_GROUPS[0][0] != _('CMS'): modules = super(OrchestraIndexDashboard, self).get_application_modules() - for register in (accounts, administration, services): + for register in (accounts, services, administration): title = register.verbose_name models = [] icons = {} diff --git a/orchestra/contrib/accounts/actions.py b/orchestra/contrib/accounts/actions.py index f5703ebd..2dc16117 100644 --- a/orchestra/contrib/accounts/actions.py +++ b/orchestra/contrib/accounts/actions.py @@ -49,7 +49,7 @@ def service_report(modeladmin, request, queryset): model = field.related_model if model in registered_services and model != queryset.model: fields.append((model, name)) - sorted(fields, key=lambda f: f[0]._meta.verbose_name_plural.lower()) + fields = sorted(fields, key=lambda f: f[0]._meta.verbose_name_plural.lower()) fields = [field for model, field in fields] for account in queryset.prefetch_related(*fields): diff --git a/orchestra/contrib/accounts/templates/admin/accounts/account/service_report.html b/orchestra/contrib/accounts/templates/admin/accounts/account/service_report.html index 1ac7a5fb..f10d116f 100644 --- a/orchestra/contrib/accounts/templates/admin/accounts/account/service_report.html +++ b/orchestra/contrib/accounts/templates/admin/accounts/account/service_report.html @@ -1,4 +1,4 @@ -{% load utils i18n %} +{% load i18n admin_urls utils %} {% block title %}Account service report{% endblock %} @@ -50,13 +50,29 @@