started hosting permissions
This commit is contained in:
parent
c70c98ecc5
commit
a8b9e02ea5
10 changed files with 81 additions and 1 deletions
19
hosting/migrations/0026_auto_20160625_0028.py
Normal file
19
hosting/migrations/0026_auto_20160625_0028.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.4 on 2016-06-25 00:28
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hosting', '0025_auto_20160621_0522'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='virtualmachineplan',
|
||||
options={'permissions': (('view_virtualmachineplan', 'View Virtual Machine Plan'), ('cancel_virtualmachineplan', 'Cancel Virtual Machine Plan'))},
|
||||
),
|
||||
]
|
||||
|
|
@ -10,6 +10,7 @@ from stored_messages.settings import stored_messages_settings
|
|||
|
||||
from membership.models import StripeCustomer
|
||||
from utils.models import BillingAddress
|
||||
from utils.mixins import AssignPermissionsMixin
|
||||
from .managers import VMPlansManager
|
||||
|
||||
|
||||
|
|
@ -82,7 +83,7 @@ class VirtualMachineType(models.Model):
|
|||
}
|
||||
|
||||
|
||||
class VirtualMachinePlan(models.Model):
|
||||
class VirtualMachinePlan(AssignPermissionsMixin, models.Model):
|
||||
|
||||
PENDING_STATUS = 'pending'
|
||||
ONLINE_STATUS = 'online'
|
||||
|
|
@ -104,6 +105,10 @@ class VirtualMachinePlan(models.Model):
|
|||
(NODEJS, 'Debian, NodeJS'),
|
||||
)
|
||||
|
||||
permissions = ('virtualmachineplan.view_virtualmachineplan',
|
||||
'virtualmachineplan.cancel_virtualmachineplan',
|
||||
'virtualmachineplan.change_virtualmachineplan')
|
||||
|
||||
cores = models.IntegerField()
|
||||
memory = models.IntegerField()
|
||||
disk_size = models.IntegerField()
|
||||
|
|
@ -116,6 +121,12 @@ class VirtualMachinePlan(models.Model):
|
|||
|
||||
objects = VMPlansManager()
|
||||
|
||||
class Meta:
|
||||
permissions = (
|
||||
('view_virtualmachineplan', 'View Virtual Machine Plan'),
|
||||
('cancel_virtualmachineplan', 'Cancel Virtual Machine Plan'),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
|
@ -142,6 +153,7 @@ class VirtualMachinePlan(models.Model):
|
|||
@classmethod
|
||||
def create(cls, data, user):
|
||||
instance = cls.objects.create(**data)
|
||||
instance.assign_permissions(user)
|
||||
return instance
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
{% load static from staticfiles %}
|
||||
<!-- Inliner Build Version 4380b7741bb759d6cb997545f3add21ad48f010b -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
{% load static from staticfiles %}
|
||||
<!-- Inliner Build Version 4380b7741bb759d6cb997545f3add21ad48f010b -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
{% load static from staticfiles %}
|
||||
<!-- Inliner Build Version 4380b7741bb759d6cb997545f3add21ad48f010b -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
{% load static from staticfiles %}
|
||||
<!-- Inliner Build Version 4380b7741bb759d6cb997545f3add21ad48f010b -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue