Filter context templates also by the ids that have been set for the calculator
This commit is contained in:
		
					parent
					
						
							
								94f520be35
							
						
					
				
			
			
				commit
				
					
						b872777bda
					
				
			
		
					 1 changed files with 9 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -88,9 +88,15 @@ class DCLCalculatorPlugin(CMSPluginBase):
 | 
			
		|||
        context = super(DCLCalculatorPlugin, self).render(
 | 
			
		||||
            context, instance, placeholder
 | 
			
		||||
        )
 | 
			
		||||
        context['templates'] = VMTemplate.objects.filter(
 | 
			
		||||
            vm_type=instance.vm_type
 | 
			
		||||
        )
 | 
			
		||||
        ids = instance.pricing.vm_templates_to_show
 | 
			
		||||
        if ids:
 | 
			
		||||
            context['templates'] = VMTemplate.objects.filter(
 | 
			
		||||
                vm_type=instance.vm_type
 | 
			
		||||
            ).filter(opennebula_vm_template_id__in=ids)
 | 
			
		||||
        else:
 | 
			
		||||
            context['templates'] = VMTemplate.objects.filter(
 | 
			
		||||
                vm_type=instance.vm_type
 | 
			
		||||
            )
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue