Add get_vm_pricing_by_name VMPricing method
This commit is contained in:
		
					parent
					
						
							
								63a12ffe06
							
						
					
				
			
			
				commit
				
					
						962c96067f
					
				
			
		
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -45,6 +45,18 @@ class VMPricing(models.Model):
 | 
				
			||||||
            if not self.vat_inclusive else 'NO_VAT', ]
 | 
					            if not self.vat_inclusive else 'NO_VAT', ]
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @classmethod
 | 
				
			||||||
 | 
					    def get_vm_pricing_by_name(cls, name):
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
 | 
					            pricing = VMPricing.objects.get(name=name)
 | 
				
			||||||
 | 
					        except Exception as e:
 | 
				
			||||||
 | 
					            logger.error(
 | 
				
			||||||
 | 
					                "Error getting VMPricing with name {name}. "
 | 
				
			||||||
 | 
					                "Details: {details}".format(name=name, details=str(e))
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					            pricing = VMPricing.get_default_pricing()
 | 
				
			||||||
 | 
					        return pricing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def get_default_pricing(cls):
 | 
					    def get_default_pricing(cls):
 | 
				
			||||||
        """ Returns the default pricing or None """
 | 
					        """ Returns the default pricing or None """
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue