Created a base template for login / signup, Fixed some html design issues on login / signup pages, Added Billing Address Form to payment page, Handle Billing Address Form validation, Created VirtualMachinePlan model in order to store user purchased VM, Create method in order to create a stripe plan , Investigated about stripe payment workflows
This commit is contained in:
		
				commit
				
					
						4777484245
					
				
			
		
					 17 changed files with 573 additions and 415 deletions
				
			
		|  | @ -1,7 +1,9 @@ | |||
| import json | ||||
| 
 | ||||
| from django.db import models | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| from django.core import serializers | ||||
| import json | ||||
| from membership.models import CustomUser | ||||
| 
 | ||||
| 
 | ||||
| class RailsBetaUser(models.Model): | ||||
|  | @ -42,7 +44,13 @@ class VirtualMachineType(models.Model): | |||
|     def get_serialized_vm_types(cls): | ||||
|         return [vm.get_serialized_data() | ||||
|                 for vm in cls.objects.all()] | ||||
|         # return serializers.serialize("json",) | ||||
| 
 | ||||
|     def calculate_price(self, specifications): | ||||
|         price = float(specifications['cores']) * self.core_price | ||||
|         price += float(specifications['memory']) * self.memory_price | ||||
|         price += float(specifications['disk_size']) * self.disk_size_price | ||||
|         price += self.base_price | ||||
|         return price | ||||
| 
 | ||||
|     def defeault_price(self): | ||||
|         price = self.base_price | ||||
|  | @ -63,3 +71,28 @@ class VirtualMachineType(models.Model): | |||
|             'default_price': self.defeault_price(), | ||||
|             'id': self.id, | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
| class VirtualMachinePlan(models.Model): | ||||
|     cores = models.IntegerField() | ||||
|     memory = models.IntegerField() | ||||
|     disk_size = models.IntegerField() | ||||
|     vm_type = models.ForeignKey(VirtualMachineType) | ||||
|     client = models.ManyToManyField(CustomUser) | ||||
|     price = models.FloatField() | ||||
| 
 | ||||
|     @classmethod | ||||
|     def create(cls, data, user): | ||||
|         instance = cls.objects.create(**data) | ||||
|         instance.client.add(user) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue