Added ‘view virtual machine plan ’ permission, Added ‘delete virtual machine plan’ permission , Added ‘view hosting order’ permission
This commit is contained in:
parent
3e6502133e
commit
4352094680
7 changed files with 47 additions and 16 deletions
|
|
@ -4,8 +4,6 @@ from django.db import models
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
|
||||
|
||||
from Crypto.PublicKey import RSA
|
||||
from stored_messages.settings import stored_messages_settings
|
||||
|
||||
|
|
@ -106,9 +104,9 @@ class VirtualMachinePlan(AssignPermissionsMixin, models.Model):
|
|||
(NODEJS, 'Debian, NodeJS'),
|
||||
)
|
||||
|
||||
permissions = ('virtualmachineplan.view_virtualmachineplan',
|
||||
'virtualmachineplan.cancel_virtualmachineplan',
|
||||
'virtualmachineplan.change_virtualmachineplan')
|
||||
permissions = ('view_virtualmachineplan',
|
||||
'cancel_virtualmachineplan',
|
||||
'change_virtualmachineplan')
|
||||
|
||||
cores = models.IntegerField()
|
||||
memory = models.IntegerField()
|
||||
|
|
@ -180,7 +178,7 @@ class VirtualMachinePlan(AssignPermissionsMixin, models.Model):
|
|||
self.save(update_fields=['status'])
|
||||
|
||||
|
||||
class HostingOrder(models.Model):
|
||||
class HostingOrder(AssignPermissionsMixin, models.Model):
|
||||
|
||||
ORDER_APPROVED_STATUS = 'Approved'
|
||||
ORDER_DECLINED_STATUS = 'Declined'
|
||||
|
|
@ -194,6 +192,13 @@ class HostingOrder(models.Model):
|
|||
cc_brand = models.CharField(max_length=10)
|
||||
stripe_charge_id = models.CharField(max_length=100, null=True)
|
||||
|
||||
permissions = ('view_hostingorder',)
|
||||
|
||||
class Meta:
|
||||
permissions = (
|
||||
('view_hostingorder', 'View Hosting Order'),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % (self.id)
|
||||
|
||||
|
|
@ -205,6 +210,7 @@ class HostingOrder(models.Model):
|
|||
def create(cls, vm_plan=None, customer=None, billing_address=None):
|
||||
instance = cls.objects.create(vm_plan=vm_plan, customer=customer,
|
||||
billing_address=billing_address)
|
||||
instance.assign_permissions(customer.user)
|
||||
return instance
|
||||
|
||||
def set_approved(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue