Pass instance context

Also POST plugin_id as a form parameter to check enable_512mb_ram
case
This commit is contained in:
PCoder 2018-10-01 07:50:15 +02:00
parent 24d719e4f1
commit f85ef714ab
2 changed files with 4 additions and 5 deletions

View File

@ -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

View File

@ -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,11 +94,11 @@
<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>
</div>
<input type="hidden" name="pricing_name" value="{% if vm_pricing.name %}{{vm_pricing.name}}{% else %}unknown{% endif%}"></input>
<input type="submit" class="btn btn-primary disabled" value="{% trans 'Continue' %}"></input>
</form>
</form>