From e8759578b547423b3966a57e19834a6ffb88acde Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Fri, 24 Apr 2015 14:03:42 +0000 Subject: [PATCH] Added services templates --- orchestra/contrib/mailboxes/admin.py | 5 +- orchestra/contrib/plans/models.py | 3 +- orchestra/contrib/plans/rating.py | 6 +- .../admin/services/service/change_form.html | 134 +++++++++++++++++- orchestra/contrib/webapps/api.py | 9 +- orchestra/contrib/websites/serializers.py | 22 +-- orchestra/templatetags/utils.py | 27 ++++ 7 files changed, 179 insertions(+), 27 deletions(-) diff --git a/orchestra/contrib/mailboxes/admin.py b/orchestra/contrib/mailboxes/admin.py index af0e111d..de5da9e3 100644 --- a/orchestra/contrib/mailboxes/admin.py +++ b/orchestra/contrib/mailboxes/admin.py @@ -112,9 +112,7 @@ class AddressAdmin(SelectAccountAdminMixin, ExtendedModelAdmin): fields = ('account_link', 'email_link', 'mailboxes', 'forward') add_fields = ('account_link', ('name', 'domain'), 'mailboxes', 'forward') inlines = [AutoresponseInline] - search_fields = ( - 'name', 'domain__name', 'forward', 'mailboxes__name', 'account__username', 'computed_email' - ) + search_fields = ('forward', 'mailboxes__name', 'account__username', 'computed_email') readonly_fields = ('account_link', 'domain_link', 'email_link') filter_by_account_fields = ('domain', 'mailboxes') filter_horizontal = ['mailboxes'] @@ -148,6 +146,7 @@ class AddressAdmin(SelectAccountAdminMixin, ExtendedModelAdmin): return '
'.join(values) display_forward.short_description = _("Forward") display_forward.allow_tags = True + display_forward.admin_order_field = 'forward' def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == 'forward': diff --git a/orchestra/contrib/plans/models.py b/orchestra/contrib/plans/models.py index deb2c196..5a9fae38 100644 --- a/orchestra/contrib/plans/models.py +++ b/orchestra/contrib/plans/models.py @@ -78,7 +78,8 @@ class Rate(models.Model): service = models.ForeignKey('services.Service', verbose_name=_("service"), related_name='rates') plan = models.ForeignKey(Plan, verbose_name=_("plan"), related_name='rates') - quantity = models.PositiveIntegerField(_("quantity"), null=True, blank=True) + quantity = models.PositiveIntegerField(_("quantity"), null=True, blank=True, + help_text=_("See rate algorihm help text.")) price = models.DecimalField(_("price"), max_digits=12, decimal_places=2) objects = RateQuerySet.as_manager() diff --git a/orchestra/contrib/plans/rating.py b/orchestra/contrib/plans/rating.py index f7380ec4..53467b3b 100644 --- a/orchestra/contrib/plans/rating.py +++ b/orchestra/contrib/plans/rating.py @@ -120,7 +120,8 @@ def step_price(rates, metric): minimal = min(minimal, (value, result), key=lambda v: v[0]) return minimal[1] step_price.verbose_name = _("Step price") -step_price.help_text = _("All price rates with a lower metric are applied.") +step_price.help_text = _("All rates with a quantity lower than the metric are applied. " + "Nominal price will be used when initial block is missing.") def match_price(rates, metric): @@ -149,4 +150,5 @@ def match_price(rates, metric): })] return None match_price.verbose_name = _("Match price") -match_price.help_text = _("Only the rate with inmediate inferior metric is applied.") +match_price.help_text = _("Only the rate with a) inmediate inferior metric and b) lower price is applied. " + "Nominal price will be used when initial block is missing.") diff --git a/orchestra/contrib/services/templates/admin/services/service/change_form.html b/orchestra/contrib/services/templates/admin/services/service/change_form.html index 5f512dcd..45cce7f6 100644 --- a/orchestra/contrib/services/templates/admin/services/service/change_form.html +++ b/orchestra/contrib/services/templates/admin/services/service/change_form.html @@ -1,5 +1,5 @@ {% extends "orchestra/admin/change_form.html" %} -{% load i18n admin_urls admin_static admin_modify %} +{% load i18n admin_urls admin_static admin_modify utils %} {% block object-tools %} @@ -7,8 +7,9 @@