Sort templates alphabetically

And also select the chosen template as the default one
This commit is contained in:
PCoder 2018-09-27 22:12:04 +02:00
commit a02c3c6973
2 changed files with 7 additions and 3 deletions

View file

@ -92,11 +92,14 @@ class DCLCalculatorPlugin(CMSPluginBase):
if ids:
context['templates'] = VMTemplate.objects.filter(
vm_type=instance.vm_type
).filter(opennebula_vm_template_id__in=ids)
).filter(opennebula_vm_template_id__in=ids).order_by('name')
else:
context['templates'] = VMTemplate.objects.filter(
vm_type=instance.vm_type
)
).order_by('name')
context['default_selected_template'] = (
instance.default_selected_template
)
return context