Added mark a notification as read feature, Fixed some errors
This commit is contained in:
parent
c33c4f4148
commit
a846f42bf6
7 changed files with 153 additions and 11 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue