Pass instance context
Also POST plugin_id as a form parameter to check enable_512mb_ram case
This commit is contained in:
		
					parent
					
						
							
								24d719e4f1
							
						
					
				
			
			
				commit
				
					
						f85ef714ab
					
				
			
		
					 2 changed files with 4 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -97,9 +97,7 @@ class DCLCalculatorPlugin(CMSPluginBase):
 | 
			
		|||
            context['templates'] = VMTemplate.objects.filter(
 | 
			
		||||
                vm_type=instance.vm_type
 | 
			
		||||
            ).order_by('name')
 | 
			
		||||
        context['default_selected_template'] = (
 | 
			
		||||
            instance.default_selected_template
 | 
			
		||||
        )
 | 
			
		||||
        context['instance'] = instance
 | 
			
		||||
        context['min_ram'] = 0.5 if instance.enable_512mb_ram else 1
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@
 | 
			
		|||
 | 
			
		||||
<form id="order_form" method="POST" action="{{calculator_form_url}}" data-toggle="validator" role="form">
 | 
			
		||||
    {% csrf_token %}
 | 
			
		||||
    <input type="hidden" name="pid" value="{{instance.id}}">
 | 
			
		||||
    <div class="title">
 | 
			
		||||
        <h3>{% trans "VM hosting" %} </h3>
 | 
			
		||||
    </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +94,7 @@
 | 
			
		|||
            <select name="config">
 | 
			
		||||
                {% for template in templates %}
 | 
			
		||||
 | 
			
		||||
                <option value="{{template.opennebula_vm_template_id}}" {% if template.name|lower == default_selected_template|lower %}selected="selected"{% endif %}>{{template.name}}</option>
 | 
			
		||||
                <option value="{{template.opennebula_vm_template_id}}" {% if template.name|lower == instance.default_selected_template|lower %}selected="selected"{% endif %}>{{template.name}}</option>
 | 
			
		||||
                {% endfor %}
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue