diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index db2912bd..ab2d6763 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -54,6 +54,7 @@ INSTALLED_APPS = ( 'django.contrib.sites', 'easy_thumbnails', 'utils', + 'stored_messages', 'mptt', 'parler', 'taggit', diff --git a/hosting/models.py b/hosting/models.py index ef33c056..518ba175 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -3,12 +3,13 @@ import os from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils.functional import cached_property -from membership.models import StripeCustomer -from utils.models import BillingAddress + from Crypto.PublicKey import RSA +from stored_messages.settings import stored_messages_settings - +from membership.models import StripeCustomer +from utils.models import BillingAddress from .managers import VMPlansManager @@ -118,6 +119,13 @@ class VirtualMachinePlan(models.Model): name = 'vm-%s' % self.id return name + @cached_property + def notifications(self): + stripe_customer = StripeCustomer.objects.get(hostingorder__vm_plan=self) + backend = stored_messages_settings.STORAGE_BACKEND() + messages = backend.inbox_list(stripe_customer.user) + return messages + @classmethod def create(cls, data, user): instance = cls.objects.create(**data) diff --git a/hosting/templates/hosting/base_short.html b/hosting/templates/hosting/base_short.html index 874b590f..55466815 100644 --- a/hosting/templates/hosting/base_short.html +++ b/hosting/templates/hosting/base_short.html @@ -71,7 +71,11 @@ My Orders - +
  • + + Notifications + +